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
This should also work:
enum : std::string::size_type { npos = std::string::size_type(-1), max_size = npos - 1 };