Fork me on GitHub

Caffeinated Bitstream

Bits, bytes, and words.

A quick survey of C++11 feature support October 6, 2012

I recently conducted a quick-and-dirty survey of C++11 (formerly known as C++0x) features available on various platforms and compilers that I had lying around. My testing was not authoritative nor rigorous. (For example, g++ without -std=c++0x actually compiles lambdas without throwing an error, so I marked it as supported even though it does give a stern warning.) I'm posting the results here, mostly for my own future reference.

Mac OS 10.6 / Xcode 4.2
gcc version 4.2.1
Apple clang version 3.0
Ubuntu 12.04
gcc version 4.6.3
Ubuntu clang version 3.0-6ubuntu3
Windows 7
MSVC++ 2010
g++ clang++ clang++ -std=c++0x g++ g++ -std=c++0x clang++ clang++ -std=c++0x cl.exe /clr
__cplusplus 1L 1L 201103L 1L 1L 1L 201103L 199711L
__GXX_EXPERIMENTAL_CXX0X__ undef undef 1 undef 1 undef 1 undef
omit space in nested template ">>" X X X X
std::tr1::shared_ptr X X X X X X X
std::shared_ptr X X X
nullptr X X X X
auto X X X X X
uniform initialization X
for range (foreach) X X X X X
move semantics (std::move) X X
raw string literals X X
encoded string literals X X
noexcept X X X
constexpr X X X
variadic templates X X X X X X
lambdas X X X
decltype X X X X
new function declaration style X X X X
scoped enums X X X X
std::function X X X
std::tr1::function X X X X X X X
can autodetect need for std::tr1 X X X X X X X X

Other, probably more thorough information about C++11 feature support:

My quick-and-dirty test suite is available for download.

UPDATE 2013-05-27: More recent platforms and compilers, below...

Mac OS 10.8 / Xcode 4.6.2
gcc version 4.2.1
Apple clang version 3.3
Ubuntu 13.04
gcc version 4.7.3
Ubuntu clang version 3.2-1~exp9ubuntu1
clang++ clang++ -std=c++11 g++ g++ -std=c++11 clang++ clang++ -std=c++11
__cplusplus 199711L 201103L 199711L 201103L 199711L 201103L
__GXX_EXPERIMENTAL_CXX0X__ undef 1 undef 1 undef 1
omit space in nested template ">>" X X X
std::tr1::shared_ptr X X X X X X
std::shared_ptr X X
nullptr X X X
auto X X X X X
uniform initialization X X
for range (foreach) X X X X X
move semantics (std::move) X X
raw string literals X X X
encoded string literals X X X
noexcept X X X
constexpr X X X
variadic templates X X X X X X
lambdas X X X X
decltype X X X
new function declaration style X X X
scoped enums X X X
std::function X X
std::tr1::function X X X X X X
can autodetect need for std::tr1 X X X X X
Comments:

This is a very useful table! However, there would seem to be one error: VC++ 2010 doesn't actually support scoped enums. It's a pity.

Posted by LN on October 06, 2013 at 02:21 AM MDT #

Post a Comment:
  • HTML Syntax: Allowed