Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-09-15 19:51:11


Stefan Slapeta <stefan_nospam__at_[hidden]> writes:

> Thorsten Ottosen wrote:
>
>> 1st vote: for or against adding these?
>>
>
> For.
>
>> 2nd vote: which naming scheme to use:
>> a: cbegin(), cr_begin()
>> b: const_begin(); const_rbegin();
>>
>
> b! cr_begin is wrong (where does the underscore come from?), it should
> have to be crbegin instead, which is ugly.
>
> > I wonder whether it's better to say
> >
> > cbegin(x)
> >
> > or
> >
> > begin(as_const(x))
> >
> > The latter is certainly more general.
> >
>
> It's more general but it has a big usability issue: it's hard for me
> to find a rationale that I can get a reverse_iterator by calling
> "rbegin" but have to apply something to the container to get a
> const_iterator.
>
> Whatever the best solution is, there should be the same concept for
> const and reverse for the user!

Just because the original designers made the mistake of building in
rbegin() and rend() accessors, it doesn't mean we should perpetuate
the same mistake for consistency.

Orthogonality is better.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

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