Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-08-17 16:27:05

"Larry Evans" <cppljevans_at_[hidden]> wrote in message
> The following code:
> <========================
> template
> < class Container
> >
> void
> test_iter_range(Container& a_cont)
> {
> typedef typename range_result_iterator<Container>::type citer_type;
> typedef iterator_range<citer_type> riter_type;
> riter_type a_riter(a_cont.begin(),a_cont.end());
> std::cout<<"a_riter.front="<<a_riter.front()<<"\n";
> }
> >=========================
> Gives compile time error when Container is const.


> Is this an error in the range lib or am I doing something wrong?

The problem is that front() specifies its return-type as

iterator_value<Iter>::type which is the same for
both iterator and const_iterator.

I think we need range_reference<T>::type to solve
this dilemma. The reference should correctly track the

Thanks for spotting this.


Boost list run by bdawes at, gregod at, cpdaniel at, john at