Вла*_*лад 2 c++ string stl stdstring
我有代码输出对象的最大长度std::string:
string s;
cout<<s.max_size()<<endl;
cout << INT_MAX << endl;
cout<<LLONG_MAX<<endl;
Run Code Online (Sandbox Code Playgroud)
输出 :
4611686018427387897
2147483647
9223372036854775807
Run Code Online (Sandbox Code Playgroud)
如果不难的话,请解释一下为什么 的最大尺寸std::string是 4611686018427387897。这大约是 的一半LLONG_MAX。