Boost logo

Boost :

Subject: Re: [boost] [gsoc] Request Feedback for Boost.Ustr Unicode String Adapter
From: Soares Chen Ruo Fei (crf_at_[hidden])
Date: 2011-08-15 11:03:00


On Mon, Aug 15, 2011, Artyom Beilis wrote:
>> From: Soares Chen Ruo Fei <crf_at_[hidden]>
>> but it does require that O(1) operations
>> don't
>>>  become O(N) operations, or that O(N) operations become O(N^2) operations.
>>
>>
>> Ok I got what you mean. I think it'll be easier to just remove the
>> decrement function completely. During implementation I also wondered
>> if there is any real use for reverse code point iterator, but since I
>> still got time I just implemented it anyway to leave it for just in
>> case. (Actually it's also because I don't know if there is any way to
>> conditionally let the code point iterator inherit from either
>> std::forward_iterator or std::bidirectional_iterator)
>
> Ok... Now I will make your life even harder :-)
>
> Many Unicode algorithms like segmentation or collation
> require random access...
>
> So you do need random access or bidirectional iterator.
>
> Bottom line... Don't bother.
>
> It is better to use Unicode in first place :-)

So if that's the case then the only way for the code point iterators
of those MBCS adapters to work with these Unicode algorithms is to
enable the O(N^2) decrement function. Or is it better to make it yield
compilation error and force the developer to manually convert the
string into other string adapters before passing to the Unicode
algorithms?

Random access is quite easy I think once we have bidirectional
iterator - just move forward/backward N times. I don't think there is
any other way to jump to random location in O(1) without having to
decode the string.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk