Does string::size return the number of array elements needed to represent the string, or the number of glyphs required to render the string? Does wstring behave the same?
Asked
Active
Viewed 240 times
0
-
5It returns the number of array elements, each one of those being a single `char`. It does not include a null termination character. – juanchopanza Jul 05 '13 at 15:43
-
and every char is a glyphs ? – Zang MingJie Jul 05 '13 at 15:44
-
["Returns the number of `CharT` elements in the `string`, i.e. `std::distance(begin(), end())`."](http://en.cppreference.com/w/cpp/string/basic_string/size) – BoBTFish Jul 05 '13 at 15:44
-
1`std::string` knows absolutely nothing about glyphs. – n. m. could be an AI Jul 05 '13 at 15:45
-
The standard says *Returns: A count of the number of char-like objects currently in the string.* It's always a good place to look. – chris Jul 05 '13 at 15:45
-
1@ZangMingJie: no, absolutely not. – n. m. could be an AI Jul 05 '13 at 15:45
-
2There's no notion of "glyph" in C++. If you want one, you have to provide and implement your own. – Kerrek SB Jul 05 '13 at 15:51