According to cppref, in C++20, std::vector::push_back
is declared as follows:
constexpr void push_back(const T& value);
I cannot imagine a scenario in which push_back
should be constexpr
.
What's the rationale behind?
Is there any rationale behind?
This is the abstract of the proposal. There is no separate rationale section:
P1004R2 Making std::vector constexpr
Abstract
std::vector is not currently constexpr friendly. With the loosening of requirements on constexpr in [P0784R1] and related papers, we can now make std::vector constexpr, and we should in order to support the constexpr reflection effort (and other evident use cases).