Edit

Share via


<string_view> typedefs

string_view
u16string_view
u32string_view
wstring_view

string_view

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

typedef basic_string_view<char, char_traits<char>> string_view;

Remarks

The following are equivalent declarations:

string_view str("Hello");

basic_string_view<char> str("Hello");

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

u16string_view

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

typedef basic_string_view<char16_t, char_traits<char16_t>> u16string_view;

Remarks

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

u32string_view

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

typedef basic_string_view<char32_t, char_traits<char32_t>> u32string_view;

Remarks

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

wstring_view

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

typedef basic_string_view<wchar_t, char_traits<wchar_t>> wstring_view;

Remarks

The following are equivalent declarations:

wstring_view wstr(L"Hello");

basic_string_view<wchar_t> wstr(L"Hello");

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

Note

The size of wchar_t is two bytes on Windows but this is not necessarily the case for all platforms. If you need a string_view wide character type with a width that is guaranteed to remain the same on all platforms, use u16string_view or u32string_view.

See also

<string_view>