Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<ol> <li><a href="https://en.wikibooks.org/wiki/More_C++_Idioms/Final_Class" rel="nofollow noreferrer">Final Class</a>: C++11 provides the <code>final</code> specifier to prevent class derivation</li> <li>C++11 lambdas substantially reduce the need for named function object (functor) classes.</li> <li><a href="https://en.wikibooks.org/wiki/More_C++_Idioms/Move_Constructor" rel="nofollow noreferrer">Move Constructor</a>: The magical ways in which <code>std::auto_ptr</code> works are no longer needed due to first-class support for rvalue references.</li> <li><a href="https://en.wikibooks.org/wiki/More_C++_Idioms/Safe_bool" rel="nofollow noreferrer">Safe bool</a>: This was mentioned earlier. Explicit operators of C++11 obviate this very common C++03 idiom.</li> <li><a href="https://en.wikibooks.org/wiki/More_C++_Idioms/Shrink-to-fit" rel="nofollow noreferrer">Shrink-to-fit</a>: Many C++11 STL containers provide a <code>shrink_to_fit()</code> member function, which should eliminate the need swapping with a temporary.</li> <li><a href="https://en.wikibooks.org/wiki/More_C++_Idioms/Temporary_Base_Class" rel="nofollow noreferrer">Temporary Base Class</a>: Some old C++ libraries use this rather complex idiom. With move semantics it's no longer needed.</li> <li><a href="https://en.wikibooks.org/wiki/More_C++_Idioms/Type_Safe_Enum" rel="nofollow noreferrer">Type Safe Enum</a> Enumerations are very safe in C++11. </li> <li><a href="https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Requiring_or_Prohibiting_Heap-based_Objects" rel="nofollow noreferrer">Prohibiting heap allocation</a>: The <code>= delete</code> syntax is a much more direct way of saying that a particular functionality is explicitly denied. This is applicable to preventing heap allocation (i.e., <code>=delete</code> for member <code>operator new</code>), preventing copies, assignment, etc.</li> <li><a href="https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Type_Generator" rel="nofollow noreferrer">templated typedef</a>: <a href="https://en.wikipedia.org/wiki/C%2B%2B11#Template_aliases" rel="nofollow noreferrer">Alias templates</a> in C++11 reduce the need for simple templated typedefs. However, complex type generators still need meta functions.</li> <li>Some numerical compile-time computations, such as fibonacci can be easily replaced using <a href="http://www.stroustrup.com/C++11FAQ.html#constexpr" rel="nofollow noreferrer">Generalized constant expressions</a></li> <li><a href="http://www.boost.org/libs/utility/utility.htm#result_of" rel="nofollow noreferrer"><code>result_of</code></a>: Uses of class template <code>result_of</code> should be replaced with <code>decltype</code>. I think <code>result_of</code> uses <code>decltype</code> when it is available.</li> <li><a href="http://www.stroustrup.com/C++11FAQ.html#member-init" rel="nofollow noreferrer">In-class member initializers</a> save typing for default initialization of non-static members with default values.</li> <li>In new C++11 code <code>NULL</code> should be redefined as <code>nullptr</code> but see <a href="http://channel9.msdn.com/Events/GoingNative/GoingNative-2012/STL11-Magic-Secrets" rel="nofollow noreferrer">STL's talk</a> to learn why they decided against it.</li> <li><a href="https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Expression-template" rel="nofollow noreferrer">Expression Template</a> fanatics are delighted to have the <a href="http://www.stroustrup.com/C++11FAQ.html#suffix-return" rel="nofollow noreferrer">trailing return type</a> function syntax in C++11. No more 30-line long return types!</li> </ol> <p>I think I'll stop there!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload