To increase the performance I'm trying to substitute std::string
with custom specializations of std::basic_string
where I'm replacing standard allocator with custom ones. One thing surprised me: the std::stoi
class of functions requires constant references to std::string
(or std::wstring
) as an input, so these functions don't work with other specializations. But logically these functions shouldn't care of how the memory is allocated; so their signatures look overly limiting.
While I could use the std::from_chars
to read integers from any string-like data, I still wonder whether there was a reason why std::stoi
is designed that way, and whether there are other STL functions designed to work with std::basic_string
templates.