要想使用标准C++中string类,必须要包含#include<string>
,而不是#include<string.h>
(字符串处理函数),using std::string/using spacename std;
string类是基于下述模版定义的:
//traits参数是一个类,它定义了类型要被表示为字符串时,所必须具备的特征。 //Allocator参数是用于处理字符串内存分配的类型。 有4种预定义的具体化
typedef basic_string<char> string;typedef basic_string<char16_t> u16string;typedef basic_string<char32_t> u32string;typedef basic_string<wchar_t> wstring;新闻热点
疑难解答
图片精选