|
Boost : |
Subject: Re: [boost] [UTF String] UTF String library 1.5 ready for perusal
From: Cory Nelson (phrosty_at_[hidden])
Date: 2011-02-13 20:11:44
On Sun, Feb 13, 2011 at 3:17 PM, Scott McMurray <me22.ca+boost_at_[hidden]> wrote:
> On Sat, Feb 12, 2011 at 05:57, Chad Nelson <chad.thecomfychair_at_[hidden]> 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've never seen anything best done at codepoint level. Â Comparing,
> rendering, and storing text all are done at different non-codepoint
> levels.
+1. I can't see any good use case for code points anywhere in the
default interface. Operations are either dumb (can operate on code
units) or complex (need grapheme clusters). While I'm sure an
in-between case exists somewhere, I think it will be quite rare.
The best design imho would expose code units and provide views for
code points and grapheme clusters.
-- Cory Nelson http://int64.org
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk