std::string构造函数

string();
string (const string& str);
string (const string& str, size_t pos, size_t len = npos);
string (const char* s);
string (const char* s, size_t n);
string (size_t n, char c);

/*
std::string str();
*/

/*
std::string stra("hello");
std::string str(stra);
std::string str(stra,0,2);
*/

/*
char pch[15]="helloworld";
std::string str(pch);
std::string str(pch,5);
*/

/*
std::string str(5,'c');
*/
posted @ 2019-06-20 15:08  JohnRed  阅读(7883)  评论(0编辑  收藏  举报