A lot of the trade-offs in picking a fixed size array versus a heap allocated array can be solved with a container that supports small vector optimization!
You see this in C++'s std::string type, which leads some people to use it for storing binary data. [1] I'm not sure what common STL-ish implementations of the idea exist.
In Rust, there's SmallVec, which has configurable storage backing and spills onto the heap when there are too many elements. [2]
You see this in C++'s std::string type, which leads some people to use it for storing binary data. [1] I'm not sure what common STL-ish implementations of the idea exist.
In Rust, there's SmallVec, which has configurable storage backing and spills onto the heap when there are too many elements. [2]
[1] https://stackoverflow.com/a/21710033/802794
[2] https://docs.rs/smallvec/0.6.10/smallvec/struct.SmallVec.htm...