Abstract
We conventionally call “classic C++” the language in its final revision in 2003, as opposed to “modern C++” (also informally known as C++0x), introduced in 2011 and subsequently refined in 2014. The set of changes was huge, but the new rules in general were written to ease TMP and make the code less verbose. Additionally, compilers come with a new arsenal of standard classes, containers, language tools (like std::bind), and traits that expose meta-information previously known only to the compiler.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
As the situation is evolving quickly, refer to online documentation. It’s not easy to find a comparison table that is simultaneously complete and up-to-date, but at the time of this writing, good references are http://wiki.apache.org/stdcxx/C++0xCompilerSupport and http://cpprocks.com/c11-compiler-support-shootout-visual-studio-gcc-clang-intel/.
- 2.
As a rule, however, it’s acceptable for metafunctions to return a “suboptimal” value. If a class destructor is known to be trivial, then the code may be optimized. A drastic assumption like “no destructor is trivial” will probably make the program slower, but it shouldn’t make it wrong.
- 3.
They are described in the freely downloadable “Draft Technical Report on C++ Library Extensions” ( http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf ).
- 4.
A list of metafunctions that ship with C++11-compliant compilers can be found here: http://en.cppreference.com/w/cpp/header/type_traits .
- 5.
For a detailed explanation of the differences between auto and decltype, see [17].
- 6.
The compiler will find the appropriate function with the standard overload resolution rules, as if it were a normal call.
- 7.
Older compilers need not respect this behavior when both directives are present, so some use of the preprocessor may be required.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2015 Davide Di Gennaro
About this chapter
Cite this chapter
Gennaro, D.D. (2015). C++0x. In: Advanced Metaprogramming in Classic C++. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-1010-9_12
Download citation
DOI: https://doi.org/10.1007/978-1-4842-1010-9_12
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-1011-6
Online ISBN: 978-1-4842-1010-9
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books