Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-05-04 18:03:19


"Eric Niebler" <eric_at_[hidden]> wrote in message
news:427903CB.4060808_at_boost-consulting.com...
|
| Peter Dimov wrote:

| > template<class R> void f( R & r )
| > {
| > typename range_iterator<R>::type i = r.begin();
| > }
| >
| > and hence, is it not perfectly logical for it to return
| > C::const_iterator for R == C const?
| >
| > It was meant to support your point.
|
|
| My understanding of the current design is that this is the purpose of
| range_result_iterator, so I would rewrite your code as:
|
| template<class R> void f( R & r )
| {
| typename range_result_iterator<R>::type i = r.begin();
| }
|
| range_iterator always evaluates to R::iterator regardless of the
| const-ness of R, and range_const_iterator always evaluates to
| R::const_iterator.
|
| In my experience with Boost.Range, I have found range_result_iterator to
| be useful. I have found little need for range_iterator and
| range_const_iterator. YMMV.

this is a good point; we mostly just need range_result_iterator<T> so it could
just be spelled
range::iterator<T>.

-Thorsten


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