C++ Standards (C++11 to C++23)
Evolution of C++ language standards
Interview Relevant: Shows awareness of modern C++
C++ Standards Evolution
C++ evolves through ISO standards, each adding new features.
Major Standards
- C++11: auto, lambdas, move semantics, smart pointers, range-for
- C++14: Generic lambdas, binary literals, digit separators
- C++17: std::optional, std::variant, structured bindings, if constexpr
- C++20: Concepts, ranges, coroutines, modules, spaceship operator
- C++23: std::print, deducing this, more constexpr
Code Examples
Examples of features from different C++ standards.
cpp
1// C++11: auto and range-for
2auto vec = std::vector<int>{1, 2, 3};
3for (const auto& val : vec) { }
4
5// C++17: structured bindings
6auto [x, y] = std::make_pair(1, 2);
7
8// C++20: concepts
9template<std::integral T>
10T add(T a, T b) { return a + b; }