HP aC++/HP ANSI C A.06.28 Release (769149-001, March 2014)
return 0;
}
Alias and alias template declarations
Alias declarations and alias template declarations are now supported in the C++11 compilation
mode.
using X = int;
X x; // equivalent to "int x"
template <typename T> using Y = T*;
Y<int> yi; // equivalent to "int* yi"
int main(int argc, char** argv)
{
yi = &x;
return 0;
}
Variadic templates
This release of the compiler supports variadic templates as described by N2242 and extended by
N2555 and N2933 in the C++11 compilation mode, enabled by the compiler option -Ax. This
feature allows templates that take variable numbers of arguments. Pack expansions are supported
in parameter lists, argument lists, brace-enclosed initializers, base class specifiers, mem-initializers,
exception specifications, attributes, and capture lists. Also note that in instantiations of functions
that have parameter packs it is now possible for multiple parameter variables to have the same
name.
template<class ...T> void f(T ...args)
{
int a[] = {0, args..., 5};
}
int main(int argc, char** argv)
{
f(1, 2, 3, 4);
return 0;
}
nullptr keyword
This release of the compiler adds support for the 'nullptr' keyword in the C++11 compilation mode.
This is treated as a null pointer constant.
void f(int n){}
void f(char* p){}
int main(int argc, char** argv)
{
f(nullptr); // invokes f(char*)
return 0;
}
Explicit conversion functions and boolean-conversion
Conversion functions marked "explicit" are now implemented in the C++11 mode. Such conversion
functions are used only for explicit casts, and not for implicit conversions. The related concept of
"boolean-converted" is also now implemented. It allows explicit conversion functions to bool to be
used to produce a bool value in contexts like the expression of an "if" statement even though such
a context is not an explicit cast.
struct A
{
explicit operator bool(){return true;}
};
int main(int argc, char** argv)
New features in version A.06.27 17