Rhe*_*hee 0 c++ namespaces include
我想使用字符串类。我还应该参与using namespace std;吗?
using namespace std;
我以为#include <string>就足够了,但是在CLion中,只有这两个(命名空间或包含)之一不存在时,会出现一些错误。
#include <string>
使事情变得更复杂的是存在<string>或<strings.h>。有什么不同?
<string>
<strings.h>
Mat*_*her 5
<string>是C ++,并提供了std::string此类。
std::string
<string.h>是C(与C ++等价<cstring>),并且仅提供要使用的函数char*。
<string.h>
<cstring>
char*
不要使用using namespace std;(请参阅C ++核心准则)。
归档时间:
6 年,7 月 前
查看次数:
130 次
最近记录: