std::string provides a max_size() method to determine the maximum number of elements it can contain.
std::string
max_size()
However, to work out the maximum lengt
The call to max_size() is delegated to the allocator used for the container.
In theory, a very smart allocator could compute its max_size in runtime, e.g. depending on RAM available.
max_size