• Skip to primary navigation
  • Skip to main content
  • Skip to footer
Scinonova logo
  • Start
  • About
  • Work
  • Blog
  • Contact
  • Swedish

6 Useful New Features in C++17 – Part 5

13 September, 2018 by Scionova

Constexpr lambdas

Since C++11 we are able to use the constexpr specifier which evaluates the expression at compile time, with C++17 lambdas can also be constant expressions. One use case could be to initialize constexpr variables that depend on other constexpr variables. See the following example:

This example maybe is silly but imagine a much more complex dependency and the array consists of more complex elements than simple integers.

Compiler Support

These features are all fully supported by GCC, MSVC, and clang. Below follows a table showing which version enables support for each feature respectively.

For more a detailed matrix with more compilers and all features of C++17 listed, follow this link.

 

Endnote

This was the last part of the series “6 Useful New Features in C++17” and I hope you found it helpful and interesting. All the previous blog posts in this series you will find under “NEWS“.

Don’t hesitate to share with your friends and colleagues and stay tuned for more!

 

 //Patrik Ingmarsson, Software Developer

Filed Under: Programmering

Footer

Gothenburg office


Theres Svenssons Gata 13,
417 55 Göteborg

Varberg office


Kungsgatan 5,
432 45 Varberg

Gasell