© Peter Van Weert and Marc Gregoire 2016
Peter Van Weert and Marc GregoireC++ Standard Library Quick Reference10.1007/978-1-4842-1876-1_6

6. Characters and Strings

Peter Van Weert and Marc Gregoire2
(1)
Kessel-Lo, Belgium
(2)
Meldert, Belgium
 

Strings    <string>

The Standard defines four different string types , each for a different char-like type:
 
String Type
Characters
Typical Character Size
Narrow strings
std::string
char
8 bit
Wide strings
std::wstring
wchar_t
16 or 32 bit
UTF-16 strings
std::u16string
char16_t
16 bit
UTF-32 strings
std::u32string
char32_t
32 bit
The names in the first column are purely indicative, because strings are completely agnostic about the character encoding used for the char-like items—or code units, as they are technically ...

Get C++ Standard Library Quick Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.