HP aC++/HP ANSI C A.06.27 Release Notes
Defaulted and deleted functions
Deleted functions (= delete;) and defaulted special member functions (= default;) are now
supported.
A deleted function is a function declaration that cannot be referenced.
For example:
int f(int) = delete;
short f(short);
int x = f(3); // Error: selected function is deleted.
int y = f((short)3); // Okay.
Special member functions that can be implicitly defined can instead be explicitly declared, but
with a default definition. As the following example shows, the default definition can be specified
inside or outside the enclosing class definition, but only if it appears inside the class can that class
be a POD type (if all other constraints for POD types are fulfilled):
struct S { S(S const&) = default; };
struct T { T(T const&); };
T::T(T const&) = default;
In C++0x mode, auto is always a type specifier, not a storage-class specifier
The traditional meaning of auto as a storage class specifier is no longer enabled. auto is therefore
always a type specifier in C++0x mode. It is used for automatic type deduction; when used in a
declaration, it makes the type of the thing declared the same as the type of whatever initialized
it. For example:
typedef int T;
int x;
void f() {
auto T(x); // This is now the declaration of a variable T
// initialized with x (and hence of the same type as x).
// Previously, it was the declaration of a variable x of type T.
auto int y; // Now an error: Multiple type specifiers.}
Lambdas
Lambda functions are now supported.
A lambda expression is an anonymous function object containing a code snippet (for example,
predicate logic) that can be specified very succinctly by the programmer without having to declare
a function-local class; it is also referred to as closure because a lambda function typically encloses
the runtime state or environment of the declaring function, being therefore able to access the local
variables of the current function.
The way these variables are accessed can be controlled using either the '&' in a lambda capture
list ([&]), in which case the variables are passed by reference; by using a '=' ([=]), whereby
the variables are simply copied (analogous to call-by-value); or a combination of the two.
Example:
int main() {
auto lambda = [] { printf("Lambda at work!"); };
lambda();
}
C99 features added to C++0x (New)
The following C99 features have been added to the C++0x standard and are available when
compiling in C++0x mode:
Mixed string literal concatenations
In C++0x mode and in default C++ mode, aC++ now accepts string literal concatenations involving
an ordinary char string literal and a wide string literal.
New features in version A.06.25 19