constexpr Additions to the Standard Library

C++17 brings a diverse range of new methods to the constexpr class. We'll talk about them below.

With this enhancement you can work with iterators, std::array, range-based for loops in constexpr contexts.

The main referencing paper is P0031 - Proposal to Add Constexpr Modifiers to reverse_iterator, move_iterator, array, and Range Access.

Have a look at a basic example that shows a basic implementation of the ​accumulate algorithm as constexpr (C++11/14/17 version of std::accumulate is not constexpr):

Get hands-on with 1200+ tech skills courses.