C++17 - What's in it?
C++17 - is officially out! So what can we as coders expect from it? With C++17 the standard-comitee brought further modernisation into the language. C++17 brings a set of new features which enhances convenience for the coder and makes writing portable code easier.
Since the introduction of the “big” C++11 standard the community could overcome much of it’s scepsis aginst the new language-constructs and features. The creed that old code still has to compile and run under the new standard is still held up. Nevertheless the comitee decided remove or mark a few features and concepts as “deprected”.
Like the past standards C++17 is strongly characterized to position the programming language C++ as modern and more userfriendly than in the past. C++ is infamous for the large amount of boilerplate code it requires, especially if working with the standard library or templates. With features like structured bindings, fold expressions and delegating constructors the new standard minimizes the amount of code a developer has to write. This works nicely into the principle of “less code is less bugs”. Working often used programming expression into easy to use language features also simplifies the code optimisation for the compiler. While not as obvious on a first glance, this is of course no less important.
Another thing that happened is the unification of the interpretation of code between different compilers and plattforms. One example is the, in many compiler already present copy elision which is now guaranteed to be performed. The same is true for the more strict order of evaluation of chained expressions. Then there are exception specification which are now a part of the type system. Both features help the coder to write better plattform- and compiler-independent code. Lots of compilers already support the standard attributes ans well as the __has_include directive, which both are now available as a common syntax.
The changes in the standard library are in C++17 again distinctively bigger than the changes in the language itself. I see this as a postitive tren, as the changes in the standard library are often more relevant for my daily coding. Especially the inclusing of the filesytem functions in the standard library, makes writing cross-plattform code massively. The addition of further algorithms for handling data containers and parallel execution again helps to write portable code. Another feature that is already known from other programming languages are the variants and the datatype std::any which are other new features added.
Apart from the listed extension there were a lot of other smaller and not-so-small features and improvements added to C++ and the standard library. A complete list of changes can be found here
So what now? All in all it can be said that C++17 brought a similar amount of changes as C++14 and C++11 still remains the big game changer. But again the newest standard brings a welcome increment in new features and improvements, which will help us producing better and more portable code.
(This article was originally published at bbv.ch in german)
The c++ logo is used in accordance to the terms of use of isocpp.org