The C++0x standard includes the decltype keyword and operator, which represents the type of an expression. This feature is one of the C++0x features added to C++Builder 2009.
The format of the decltype operator is:
decltype ( expression )
Here are the rules for evaluating decltype(e):
See the embedded contents in the following examples.
const char *namePtr, nameChar;
decltype(namePtr); // type is const char*
decltype(nameChar); // type is const char
int& F(void);
decltype(F()); // type is int&
struct; D {double value; }
const D* d = new D();
decltype(d->value); // type is double
decltype((d->value)); // type is const double&
double GetValue(int one);
long int GetValue(double d);
decltype(GetValue); // ill-formed -- ambiguous|
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
|
What do you think about this topic? Send feedback!
|