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:
posted at 2012-10-06 19:54:21 MDT
by David Simmons
tags: c++11 c++ c++0x
