c++ string 最大长度
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string s="";
unsigned long long a=0;
a = ~a;
unsigned int b = 0;
b = ~b;
cout<<s.max_size()<<endl;
cout<<a<<endl;
cout<<b<<endl;
return 0;
}
4611686018427387903
18446744073709551615
4294967295
分别是:
2^61 即 62个1
2^63 即 64个1
2^31 即 32个1