What’s New in C++11/14/17 a.k.a. Modern C++
In September 2011 the standard ISO/IEC 14882:2011 – aka C++11 – was settled. We saw the beginning of the era of “Modern C++”. “Modern C++”: A designation that has been given to this major revision, and the succeeding revisions of the C++ standard. We had a revolution with C++11. With the revisions C++14 and C++17, and the upcoming C++20 – we see an evolution. The time line below illustrates this.
Looking upon the number of features brought in since C++11 and think about their impact, one can conclude: Pre-Modern C++ – aka Classical C++ – and Modern C++ are two different languages. To quote Bjarne Stroustrup: “C++11 feels like a new language”.
Modern C++ emphasizes:
- Type inference with
autoinstead of explicit type names.
- Stack-based scope instead of heap or static global scope – profoundly applying the RAII idiom.
std-library smart pointers instead of naked raw pointers.
wstring-types instead of raw arrays of
std::stringand c-string based APIs.
std-library containers like
unordered_mapinstead of raw arrays or “home-made” containers.
std-library algorithms instead of “hand-coded” ones.
- Range-based for loops to write more robust loops that work with arrays and containers.
- Exceptions, to deal with recoverable error conditions.
- Local lambda functions instead of separately implemented functions or function objects.
- Lock-free mutual exclusion using
atomic<>instead of alternative mutual exclusion mechanisms.
This training picks up where an intermediate C++-training would end. The main themes are maintainability and testability.
Furthermore, we will explore many issues and features in C++ like:
- Writing code with testability in mind
- Understand the importance of thorough memory management
- Write generic code using templates
- Get more acquainted with the C++ standard library so that “a lot of home-made coding can be avoided”
- Reasoning about sound and robust APIs where, for instance, raw memory shall never be exposed.
- Comprehend the minimal effort required to write exception-safe code
The major objective of this class is that you shall be able to use C++ in a “correct way”. We summarize the training by reasoning about and concluding how a “good” API shall look like.
This training is aimed experienced C++-programmers who want to comprehend and deepen the knowledge in Modern C++.
The course requires basic skill, at least 3 years’ experience, in C++ programming.
During the training you will practice the presented topics in a few exercises.
We will write unit tests as a natural part of each exercise.
We will use the open and free integrated development environment from Eclipse.