10 Sep
2019
10 Sep
'19
10:19 a.m.
"Hans Dembinski via Boost"
This was probably discussed here before, but could someone remind me why static_string and static_vector need to exist as separate containers at all? Why don't we use a boost::vector and boost::string with a special allocator that offers a fixed-sized memory pool allocated from the stack?
This is how static_vector is implemented, afaik. The main drawback is that it makes static_vector not trivially_copyable even for trivial T. I ended up reimplementing a custom static_vector for this reason only. I don't think it makes much sense to have a static_string which is not trivially copyable (which would probably be the case if using a specialization with an allocator). Regards, Julien