Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-09-15 11:29:11


[Note: this is a reply to Thorsten's post, which hasn't shown up on my
newsreader yet. I've been missing a lot ot messages lately -- is this happening
to anyone else?]

> "Thorsten Ottosen" <nesotto_at_[hidden]> writes:
>
> > Dear All,
> >
> > In the pre-redmond mailing Walter Brown discusses the possibility of adding
> > these members to standard container classes:
> >
> > const_iterator cbegin();
> > const_iterator cend();
> > const_reverse_iterator crbegin();
> > const_reverse_iterator crbegin();
> >
> > The motiviation is that we want to be able to say explicitly "give me a
const
> > iterator" without doing ugly casts.
> > IMO a sound idea.
> >
> > Given the framework in boost.range these would be absolutely *trivial* to
add.
> >
> > 1st vote: for or against adding these?
> >
> > 2nd vote: which naming scheme to use:
> >
> > a: cbegin(), cr_begin()
> >
> > b: const_begin(); const_rbegin();
> >
> > The motivation for chosing the latter could be that "cr" contracttions
become
> > harder to read.
> >
> > Let me know what ya think.

I faced this problem with the memory-mapped file implementation in iostreams,
since whether the underlying file is open in read-only mode has absolutely
nothing to do with whether the mapped_file object is const. I chose
'const_begin' and 'const_end' because these names

    - sound very natural to me
    - are not too verbose
    - make the sematics obvious.

Best Regards,
Jonathan


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