
On 30 Sep 2025 13:25, Ivan Matek via Boost wrote:
8. vector32: May be stupid idea with "noise" performance improvement, but I was always annoyed that vector uses 2 64 bit fields for size and capacity when(unless you use small types like char or short or int) my computer would ran out of memory before you could get vector that big. So for example vector32<std::string> can support up to 4GigaStrings(great unit) since it splits capacity and size in 2 32 bit fields(obviously data must be 64bit).
This is already possible: template< typename T, typename Allocator = void, typename... Options > using vector32 = boost::container::vector< T, Allocator, boost::container::vector_options_t< boost::container::stored_size< std::uint32_t >, Options... >
;
You can also similarly define small_vector32, (small_)flat_set32, etc.
14. SecureString - tbh I am worried about maintenance of this guy, it could be just my paranoia since IDK how elaborate future attacks(or compiler optimizations) might realistically be i.e. is it possible that secure erasure gets broken and it needs a hotfix asap.
My understanding is that the idea is to not leak sensitive strings in memory after the string is destroyed. I think, it does have value (and I have needed it a few times). It can be implemented fairly reliably e.g. using a signal fence or a dummy asm block. And it can be unit-tested by using a custom memory allocator. I think, it would probably be preferable not in the form of a special string type but rather an allocator, so that the protection can be applied to a variety of containers (e.g. std::vector). Of course, string has SSO, and there are also containers with similar optimization (e.g. small_vector). There needs to be some collaboration between containers implementing SSO-like optimizations and the allocator. Maybe the allocator should provide an optional function that would be detected by the container and invoked on clear()/erase()/destructor.
15. GermanString - I would suggest picking better name, unless it really sticks in the community. https://www.reddit.com/r/programming/comments/1e5gzq2/comment/ldmj266/
Yes, I found this name surprising too.