How do I check for C++11 support?
There is a constant named __cplusplus
that C++ compilers should set to the version of the C++ standard supported see this
#if __cplusplus <= 199711L
#error This library needs at least a C++11 compliant compiler
#endif
It is set to 199711L in Visual Studio 2010 SP1, but I do not know if vendors will be so bold to increase it already if they just have (partial) compiler-level support versus a standard C++ library with all the C++11 changes.
So Boost's defines mentioned in another answer remain the only sane way to figure out if there is, for example, support for C++11 threads and other specific parts of the standard.
As stated by the C++11 standard (§iso.16.8):
The name __cplusplus is defined to the value 201103L when compiling a C++ translation unit.
With the value of that macro, you can check whether the compiler is C++11 compliant.
Now, if you are looking for a standard way to check if the compiler supports a whatsoever subset of C++11 features, I think there is no standard, portable way; you can check compilers documentation or std library header files to get more information.