r/cpp • u/User_Deprecated • Aug 26 '26
C++26: std::inplace_vector
https://www.sandordargo.com/blog/2026/08/26/cpp26-inplace-vector
181
Upvotes
r/cpp • u/User_Deprecated • Aug 26 '26
View all comments
Show parent comment
2
u/Raknarg Sep 01 '26
This wouldn't fix anything. inplace_vector stores its data locally within the structure itself, while vector stores it through a pointer. You can't get around this, you need a different type who's designed to offer storage inside the vector. Allocator doesn't fix this, where is it gonna allocate to?
edit: I guess the allocator type itself has the storage? I didn't think about this but I guess this could actually work, but you still would need to fix all the requirements around resizing and whatnot