Boost logo

Boost :

Subject: Re: [boost] [gsoc] Request Feedback for Boost.Ustr Unicode String Adapter
From: Gordon Woodhull (gordon_at_[hidden])
Date: 2011-08-14 16:37:28


On Aug 14, 2011, at 10:12 AM, "Phil Endecott" <spam_from_boost_dev_at_[hidden]> wrote:

> It would be better to not provide the inefficient case at all. Compare with how std::list doesn't provide random access, even though it could do so in O(N). Looking at your character set iterator, it seems to me that you could have a forward-only iterator and a bidirectional iterator for UTF, but only the former for these other encodings. Not storing the begin iterator when only forward iteration is needed also saves space.

+1

Please use standard iterator concepts and provide the expected behavior. Emulating bidirectional or random access iterators on top of a forward iterator is never good. People can use std::advance if they really need to.

It's not just an issue for really long strings. Consider someone trying to read a moderate sized string backward. If only forward access is possible efficiently, there should be no operator--().

Cheers
Gordon


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