C++11 - STL Additions

32
C++11 STL additions

description

This presentation considers certain specific features of C++11 and additions to STL library (uniform initialization, new containers and methods, move semantics). Presentation by Taras Protsiv (Software Engineer, GlobalLogic), Kyiv, delivered at GlobalLogic C++ TechTalk in Lviv, September 18, 2014. More details - http://www.globallogic.com.ua/press-releases/lviv-cpp-techtalk-coverage

Transcript of C++11 - STL Additions

  • 1. STL additions

2. Uniform initialization syntaxMove semanticNew methodsNew containersstd::tuple 3. Very common code:for (set >::const_iterator thread =clientThreads.begin();thread != clientThreads.end(); thread++){/* ... */}Allow compiler to deduce type:for (auto thread = clientThreads.begin();thread != clientThreads.end(); ++thread){/* ... */} 4. Simplify iteration for standard containers:int v[] { 1, -4, 11 };for (int& i: v) { // for ( auto& i : v )i += 42;}for (int i: v) { // for ( auto i : v )cout