std::basic_string::max_size in C++
std::basic_string::max_size is used to compute the maximum number of elements the string is able to hold due to system or library implementation limitations.
size_type max_size() const;
Parameters : None
Return value : Maximum number of characters
Exceptions : None
#include <iostream>
#include <string>
int main()
{
std::string str;
std::cout << "Maximum size of a string is " << str.max_size() << std :: endl;
}
|
Output:
Maximum size of a string is 4294967294
Note : The maximum size can depend on the compiler and system.
Last Updated :
12 Jun, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...