Why do you need to replace something?
string
and wstring
are string classes corresponding to char
and wchar_t
, which, in the context of interacting with the environment, are designed to transfer data encoded, respectively, with a "narrow multi-byte representation of the system" and a fixed width in "system encoding".
On the other hand, u8
/ u
/ u
, as well as char16_t
and char32_t
, as well as the corresponding string classes, are intended for storing Unicode code sequences encoded in UTF-8/16/32.
The latter is a separate problem area from the former. The standard does not contain a mechanism for combining two domains (and usually requires a library such as iconv()
to make this bridge portable, for example, by recoding WCHAR_T / UTF-32).
Here is my standard list of related questions: # 1 , # 2 , # 3
source share