If you need an excuse for celebration, today happens to be an anniversary! The C++11 standard was approved by ISO on 12 August last year, exactly one year ago. I decided to take a look at the state of C++11 language support one year on across three compilers: the upcoming VS11 (Visual Studio 2012), g++ 4.7 and Clang 3.1.

Please note I didn’t detail the non-language concurrency changes. Generally, support for those remains limited.

FeatureVS11g++ 4.7Clang 3.1
autoYesYesYes
decltypeYesYesYes
Rvalue references and move semanticsYesYesYes
Lambda expressionsYesYesYes
nullptrYesYesYes
static_assertYesYesYes
Range based for loopYesYesYes
Trailing return type in functionsYesYesYes
final method keywordYesYesYes
override method keywordYesYesYes
Strongly typed enumsYesYesYes
Forward declared enumsYesYesYes
extern templatesYesYesYes
>> for nested templatesYesYesYes
Local and unnamed types as template argumentsYesYesYes
Variadic macrosYesYesYes
New built-in typesPartialYesYes
Initializer listsNoYesYes
explicit type conversion operatorsNoYesYes
Inline namespacesNoYesYes
sizeof on non-static data members without an instanceNoYesYes
Changed restrictions on union membersNoYesYes
Raw string literalsNoYesYes
User defined literalsNoYesYes
Encoding support in literalsNoYesYes
Arbitrary expressions in template deduction contextsNoYesYes
Defaulted methodsNoYesYes
Deleted methodsNoYesYes
Non-static data member initializersNoYesYes
Variadic templatesNoYesYes
Default template arguments in function templatesNoYesYes
Template aliasesNoYesYes
Forwarding constructorsNoYesYes
noexceptNoYesYes
constexprNoYesYes
Alignment supportPartialNoYes
Rvalue references for *thisNoNoYes
C99 compatibilityPartialPartialPartial
Thread local storagePartialPartialNo
Inheriting constructorsNoNoNo
Generalized attributesNoNoNo

Clang is leading with the most C++11 features implemented, and Visual Studio is unfortunately lagging behind. Still, there is a decent subset of features already available for cross-platform development using these three compilers.

You can use type inference, move semantics and rvalue references, nullptr, static_assert, and range-based for loop.

You can have finer control over inheritance using final and override keywords. Enums can be strongly typed and forward declared. There are several improvements to templates, including the extern keyword.

Sadly, the much requested variadic templates aren’t available in Visual Studio. Variadic macros, on the other hand, are implemented in all three compilers for C99 compatibility.

The features that aren’t implemented anywhere are inheriting constructors and generalized attributes. Thread local storage is at best partially supported (via non-standard keywords).

Overall, I think this represents good progress and shows that at least a subset of C++11 can be used today for cross-platform projects.