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 ...