r/cpp 6d ago

C++26: std::inplace_vector

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

121 comments sorted by

View all comments

1

u/frankist 3d ago

Is trivial copy of inplace_vector if T is trivial something always desirable? I am imagining the case where I am copying a large capacity inplace_vector that is empty or almost empty (.size() ~ 0). Trivial copy will mean that I will copy a lot of bytes that don't contain anything.

1

u/dapzar 16h ago

If the capacity is so large that one starts to worry about memcpy performance (more than a few kB), then I probably don't want to use this type to have it on the stack.