Subject: Re: [boost] RFC: interest in Unicode codecs?
From: Eric Niebler (eric_at_[hidden])
Date: 2009-07-20 13:42:41
Mathias Gaunard wrote:
> Rogier van Dalen wrote:
>> Non-checking iterator adaptors can be faster. That would be useful
>> when you know that a string is safe, for example, in a UTF string type
>> that has a validity invariant.
> I suppose that type of string should probably use optimized iterators
> that make use of the fact it is stored on contiguous and properly
> aligned memory anyway, so it will need special code.
There are 2 orthogonal issues here:
1) whether a sequence is stored in contiguous memory
2) whether it is already guaranteed to be well-formed UTF-XX
Conflating the two will lead to bad design. I agree with Rogier. The
routines should make checking a policy. Iterators should be non-checked.
Checked iterators can be adaptors.
This is important to get right. You can build safe interfaces on top of
fast ones, but not the other way around.
-- Eric Niebler BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk