包括< xstring>,< cstring>,< string>和< wstring>在C ++中 [英] Differences among including <xstring>, <cstring>, <string> and <wstring> in C++
问题描述
我看到以下 #include
指令:
#include <xstring>
#include <cstring>
#include <string>
#include <wstring>
这些包含指令有什么区别?
What are the differences among these include directives? Did I miss any others that should be considered part of this group?
推荐答案
< string> / code>是
std :: string
的定义。
; xstring>
是一个Microsoft C ++头文件,其中包含 std :: basic_string
模板的实际实现。您不需要包括< xstring>
自己。 < string>
包括 basic_string
实现。
<xstring>
is a Microsoft C++ header containing the actual implementation of the std::basic_string
template. You never need to include <xstring>
yourself. <string>
includes it for the basic_string
implementation.
< cstring>
是标准C字符串库( strcpy
, strcat
,等)放置到C ++
std
命名空间中。
<cstring>
is the standard C string library (strcpy
, strcat
, etc) placed into the C++ std
namespace.
wstring
不是我知道的头文件。 std :: wstring
是 wchar_t
版本 std :: string
并且在包括< string>
时定义。
wstring
is not a header file that I'm aware of. std::wstring
is the wchar_t
version of std::string
and is defined when including <string>
.
这篇关于包括< xstring>,< cstring>,< string>和< wstring>在C ++中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!