r/cpp • • Aug 26 '26

C++26: std::inplace_vector

https://www.sandordargo.com/blog/2026/08/26/cpp26-inplace-vector
183 Upvotes

121 comments sorted by

View all comments

Show parent comment

5

u/KuntaStillSingle Aug 27 '26

I thought this was the way-more-useful thing where you give it an in-place capacity and it allocates once it exceeds that

pmr vector using monotonic buffer does this with the default upstream memory resource:

https://en.cppreference.com/cpp/memory/monotonic_buffer_resource/monotonic_buffer_resource

3

u/drjeats Aug 27 '26

TIL, that's useful.

We deserve a non-pmr pre-sized SBO vector derived from std::vector though.