std::string src;
cout<<"maximum length of string : "<<src.max_size();
Output I get is:
maximum length of string : 1073741820
I need to create a large array of strings, like string input[100000], but I get run time error when I use array indices more than 80,000. Length of my string variables are less, average length is 15 characters. So I need to limit the length of the string variable.
Following are my questions:
What factors are considered for deciding the larget index of the string array?
How do I reduce the max_size() of string variable?
max_sizemax_sizehas absolutely nothing to do with this. It's not contributing to your error and it's not taking up memory. The entire premise of the question is broken.std::vector<std::string>.