C++14 Features
C++ 17 Features
- SIMD and Vectorization in
std::for_each
- std::optional to indicate whether a variable has trustable value
- std::reduce to aggregates (or “reduce”) a container into something else
- Structural binding to make unpacking easier
Cpp 20 Features
C++20 is a large coding standard upgrade (from C++ 17 code) with lots of new paradigms.
- Template lambda for more explicit typing See here
- Concepts for type constraints, see here
- Ranges For Lazy Evaluation
- Constexpr on dynamically allocated objects
- Coroutine For Async Programming
Summary
Feature | C++17 | C++20 | Benefit |
---|---|---|---|
Template Lambdas | auto only |
template<> |
More type flexibility |
Concepts (std::integral ) |
enable_if |
Cleaner syntax | Faster compilation |
Ranges (views::filter ) |
Manual loops | Functional style | Concise, lazy evaluation |
Coroutines (co_await ) |
Threads + Futures | Native coroutines | Simpler async code |
constexpr STL Containers |
Limited | std::vector<> allowed |
Compile-time optimizations |