I'm having some trouble figuring out the exact semantics of std::string.length(). The documentation explicitly points out that length() returns the number of characters in the string and not the number of bytes. I was wondering in which cases this actually makes a difference.
In particular, is this only relevant to non-char instantiations of std::basic_string<> or can I also get into trouble when storing UTF-8 strings with multi-byte characters? Does the standard allow for length() to be UTF8-aware?
wchar_thas a fixed size like any other type. It can't magically vary.std::stringvs.std::wstringand some stuff about Unicode: stackoverflow.com/questions/402283/stdwstring-vs-stdstringwstringhas nothing to do with UTF. Perhaps you were thinking ofu16stringoru32string?