Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
We recommend using Visual Studio 2017

wstring

A type that describes a specialization of the template class basic_string with elements of type wchar_t.

Other typedefs that specialize basic_string include string, u16string, and u32string.

typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t>> wstring;

The following are equivalent declarations:

    wstring wstr(L"");

    basic_string<wchar_t> wstr(L"");

For a list of string constructors, see basic_string::basic_string.

NoteNote

The size of wchar_t is implementation-defined. If your code depends on wchar_t to be a certain size, check your platform's implementation (for example, with sizeof(wchar_t)). If you need a string character type with a width that is guaranteed to remain the same on all platforms, use string, u16string, or u32string.

Header: <string>

Namespace: std

Show:
© 2018 Microsoft