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

fenbf
598.6K views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

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?
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content