tags:

views:

248

answers:

2

What are the differences between:

#include <xstring>

#include <cstring>

#include <string>

#include <wstring>

?

(anymore? lol)

+12  A: 

Only the latter two are Standard headers. The first is some non-standard header.

#include <cstring>

This is <string.h>, but with the declarations put into namespace std. It's the "C++ version" of the C header.

#include <string>

This is where std::string is defined. It has nothing to do with the C header.

Johannes Schaub - litb
Even faster than me copying parts of the man pages.
pmr
+8  A: 

<string> is where std::string is defined.

<xstring> is a Microsoft C++ header containing the actual implementation of the std::basic_string template. You never need to include that file on your own. <string> includes it for the basic_string implementation.

<cstring> is the standard C string library (strcpy, strcat, etc) placed into the C++ std namespace.

jmucchiello
While you are at it, might as well add wstring ;-)
ShaChris23
wstring is not a header file that I'm aware of. std::wstring is the wchar_t version of std::string.
jmucchiello