
On Sun, 13 Feb 2011 15:17:30 -0800 Scott McMurray <me22.ca+boost@gmail.com> wrote:
On Sat, Feb 12, 2011 at 05:57, Chad Nelson <chad.thecomfychair@gmail.com> wrote:
What do you use string.length() for? :-) Efficiently providing an answer to that is one of several things the UTF string classes keep track of it for.
Seeing if a string will "fit", under various meanings: * wrapping (like 80-column console lines) * fixed-width fields (like ID3v1)
Neither of which are things that are applicable at codepoint level :)
I don't know what the code-point length might be needed for, though that doesn't mean much as I haven't played with Unicode for very long. But std::string has that capability, so anyone who wants to use the UTF classes as std::string equivalents, or even replacements -- the target audience for the library -- will expect it, whether they end up using it or not.
I've never seen anything best done at codepoint level. Comparing, rendering, and storing text all are done at different non-codepoint levels.
Anything that operates at a higher level, such as glyphs or true Unicode characters, has to operate on code-points. -- Chad Nelson Oak Circle Software, Inc. * * *