Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
With each C++ standard, we aim for simpler, cleaner and more expressive way to code. C++17 offers several "big" language features that should make our code nicer. Today, I tried to pick seven things that make your code more compact right off the bat.
- Structured bindings/Decomposition declarations
- Init-statement for if/switch
- Inline variables
- constexpr if
- Fold expressions
- Template argument deduction for class templates
- Declaring non-type template parameters with auto
I've added more examples, and what's more important most of the code can be invoked in the browser! You can play with the samples and experiment with the new language features.
Documents & Links
First of all, if you want to dig into the standard on your own, you can read the latest draft here:
N4659, 2017-03-21, Working Draft, Standard for Programming Language C++ - the link also appears on the isocpp.org.
And you can also grab my list of concise descriptions of all of the C++17 language features:
It's a one-page reference card, pdf.
More reference links:
- Compiler support: C++ compiler support
- The official paper with changes: P0636r0: Changes between C++14 and C++17 DIS
- My master C++17 features post: C++17 Features
- Jason Turner: C++ Weekly channel, where he covered most (or even all!) of C++17 features.
- There's also a talk from Bryce Lelbach: C++Now 2017: C++17 Features
OK, let's discuss the features!