Back
Close

7 Features of C++17 that will simplify your code

fenbf
585.6K views

Summary

In my opinion, C++17 makes real progress towards compact, expressive and easy to read code.

One of the best things is constexpr if that allows you to write template/metaprogramming code in a similar way to standard code. For me, it's a huge benefit (as I am always frightened of those scary template tricks).

The second feature: structured bindings (that works even in for loops) feels like code from dynamic languages (like Python).

As you can see all of the mentioned features are already implemented in GCC and Clang. If you work with the recent versions of those compilers you can immediately experiment with C++17. Soon, a lot of those features will be available in VS: VS 2017.3

Once again, remember to grab my C++17 Language Ref Card .

  • What are your best C++17 language features that make code cleaner?
  • Have you played with constexpr if or structured bindings?
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io