I have seen the following #include
directives:
#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>
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 <xstring>
yourself. <string>
includes it for the basic_string
implementation.
<cstring>
is the standard C string library (strcpy
, strcat
, etc) placed into the C++ std
namespace.
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>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With