Skip to content

Latest commit

 

History

History
91 lines (64 loc) · 3.94 KB

File metadata and controls

91 lines (64 loc) · 3.94 KB
title <string> typedefs | Microsoft Docs
ms.custom
ms.date 11/04/2016
ms.reviewer
ms.suite
ms.tgt_pltfrm
ms.topic article
f1_keywords
string/std::string
string/std::u16string
string/std::u32string
string/std::wstring
ms.assetid fdca01e9-f2f1-4b59-abda-0093d760b3cc
caps.latest.revision 12
manager ghogen

<string> typedefs

string u16string u32string
wstring

string

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

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

typedef basic_string<char, char_traits<char>, allocator<char>> string;

Remarks

The following are equivalent declarations:

string str("");

basic_string<char> str("");

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

u16string

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

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

typedef basic_string<char16_t, char_traits<char16_t>, allocator<char16_t>> u16string;

Remarks

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

u32string

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

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

typedef basic_string<char32_t, char_traits<char32_t>, allocator<char32_t>> u32string;

Remarks

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

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;

Remarks

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.

Note

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.

See Also

<string>