I wrote this just for fun when saw article about sso in Rust. My string can store up to 23 (excluding null-terminator) 8-bit chars without calling all

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2024-10-12 18:30:03

I wrote this just for fun when saw article about sso in Rust. My string can store up to 23 (excluding null-terminator) 8-bit chars without calling allocator.

way to configure usage of exceptions. This can be achived with macros, but I want to try use something like traits/policies. E.g. std::string use std::char_traits, what about creating exception_traits/throw_policy/throw_strategy?

strategy for preallocating more memory then need now I allocate exactly as much as I need. I want to do this behaviour configurable and see few ways:

And there is also one problem(mistake?). When string is small (placed on stack) I use simple O(n) algo for calculate length. That's why it can return wrong length if string contains null-terminator inside. This can be fixed by occupying one byte for store length.

Leave a Comment