I was told the following was possible due to changes in C++11:
class SomeType {
int number;
public:
SomeType(int new_number) : number(new_number) {}
SomeType() : SomeType(42) {}
};
But when I try to build I get an error:
"SomeType" is not a nonstatic data member or base class of class "SomeType"
error C2614: 'SomeType' : illegal member initialization: 'SomeType' is not a base or member
Is this feature not yet supported in Visual Studio 2010? Do I need to configure something to get this to build? What is wrong?
It's not supported in VS2010. Most C++11 features are not supported in VS2010 (or VS11 for that matter)
Here is a chart of supported features in VC10 and VC11.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.