std::string, wstring, u16/32string clarification

前端 未结 1 369
鱼传尺愫
鱼传尺愫 2021-01-17 16:48

My current understanding of the difference between std::string and std::wstring is simply the buffer\'s type; namely, char vs wc

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-17 17:13

    The difference is that the details of char and wchar_t are implementation defined, while the encoding of char16_t and char32_t are explicitly defined by the C++11 standard.

    This means that wstring is likely to store the same data as either u16string or u32string, but we don't know which one. And it is allowed for some odd implementation to make them all different, as the size and encoding of the old char types are just not defined by the standard.

    0 讨论(0)
提交回复
热议问题