public member function
<string>
std::string::max_size
size_t max_size() const noexcept;
Return maximum size of string
This is the maximum potential length the string can reach due to known system or library implementation limitations, but the object is not guaranteed to be able to reach that length: it can still fail to allocate storage at any point before that length is reached.
Parameters
noneReturn Value
The maximum length the string can reach.size_t is an unsigned integral type (the same as member type string::size_type).
Example
|
|
A possible output for this program could be:
size: 11 length: 11 capacity: 15 max_size: 4294967291
Complexity
Unspecified, but generally constant.
Constant.
Iterator validity
No changes.Data races
The object is accessed.Exception safety
No-throw guarantee: this member function never throws exceptions.See also
- string::capacity
- Return size of allocated storage (public member function)
- string::size
- Return length of string (public member function)
- string::resize
- Resize string (public member function)