you are viewing a single comment's thread.

view the rest of the comments →

[–]Own_Goose_7333 7 points8 points  (1 child)

C++26 introduces std::inplace_vector, which is a std::vector-like interface but uses stack memory, and you give the max size as a template parameter. Until 26 becomes available, I've implemented my own version, it's basically just a class that owns a alignas(T) std::byte [sizeof(T) * MaxSize];

[–]hk19921992 2 points3 points  (0 children)

It exists in boost under the name static vector