<string> 之间的区别和<string.h>?
这段代码怎么来的
std::map <std::string , int> m;
m["a"]=1;
编译(我使用的是 MSVC 2010)
compiles with (I'm using MSVC 2010)
#include <string>
但没有
#include <string.h>
?
推荐答案
<string.h>包含旧函数,如strcpy、strlen用于 C 风格的空终止字符串.<string>主要包含std::string、std::wstring等类.<string.h>contains old functions likestrcpy,strlenfor C style null-terminated strings.<string>primarily contains thestd::string,std::wstringand other classes.
相关文章