class NonCopyable
{
public:
NonCopyable() = default;
NonCopyable(const NonCopyable&) = delete;
NonCopyable& operator=(const NonCopyable&) = delete;
};
I have tried the above code with VS2010 and it doesn’t pass the compilation.
1>c:\temp\app1\app1\app1.cpp(12): error C2065: 'default' : undeclared identifier
1>c:\temp\app1\app1\app1.cpp(12): error C2253: 'NonCopyable' : pure specifier or abstract override specifier only allowed on virtual function
1>c:\temp\app1\app1\app1.cpp(13): error C2059: syntax error : ';'
1>c:\temp\app1\app1\app1.cpp(13): error C2238: unexpected token(s) preceding ';'
1>c:\temp\app1\app1\app1.cpp(14): error C2059: syntax error : ';'
1>c:\temp\app1\app1\app1.cpp(14): error C2238: unexpected token(s) preceding ';'
1>
1>Build FAILED.
Question> As far as I know, default and delete are new features for C++0x.
Does VS2010 support those new standard?
// updated — it is supported with gcc version 4.5.2 //
// gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)
$ ~/Documents/C++ $ g++ -o t2 t2.cpp -std=c++0x
No, sadly VC2010 does not. It doesn’t even support automatically generated move constructors.
Here is a list of C++11 features VC2010 supports. Note that some of them are only partially supported.