std::string
provides a max_size()
method to determine the maximum number of elements it can contain.
However, to work out the maximum length of a string in general, the programmer has to create a (possibly empty) string object.
If this class doesn't need any information from the programmer, why isn't max_size()
available as a compile-time constant ? Is there some kind of runtime information necessary for a string to work out its maximum size ?