When should I use a std::inplace_vector instead of a std::vector?
08:06 29 Oct 2024

There is a new std::inplace_vector in the C++ standard library that seems to have a fixed capacity defined at compile time. I'm trying to understand a use case for std::inplace_vector instead of std::array or std::vector. It seems like std::inplace_vector has the advantage of a fixed size capacity, like std::array, but instead does not require object initialization until insertion. But, unlike std::vector, std::inplace_vector has a fixed compile-time capacity.

Can anyone provide an example of where std::inplace_vector might be useful?

c++ std c++26