4 ms·
One of my favorite data structures in C++ is InlineVector<T,N>. If the number of elements is <= N then it all fits in the preallocated space. This is great for
by zackees 6y ago
One of my favorite data structures in C++ is InlineVector<T,N>. If the number of elements is <= N then it all fits in the preallocated space.
This is great for keeping memory on the stack when N is small, yet allow heap memory overflow for larger N.
- withtypes 6y agoIn Rust there is smallvec https://docs.rs/crate/smallvec/ https://docs.rs/crate/smallvec/