Reputation: 774
To give a specific example, the push_back() member functions of std::vector became constexpr in C++20.
https://en.cppreference.com/w/cpp/container/vector/push_back
Upvotes: 2
Views: 223
Reputation: 118425
One of the requirements of a constexpr
function is that it can only call other constexpr
functions.
So, this allows push_back
() to be called from some other constexpr
function that might, actually, return something useful.
Upvotes: 5