Boost logo

Boost :

Subject: Re: [boost] [range] iterator_range::operator[] broken
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-04-13 22:57:45


AMDG

Eric Niebler wrote:
> On 4/13/2010 6:53 PM, Eric Niebler wrote:
>
>> Neil, I know you patched this a mere 5 hours ago, but it's still broken.
>> The attached patch *really* fixes the problem, I think.
>>
>
> Hrm, that patch helped, but it doesn't fix everything. For instance, I
> can't do this anymore:
>
> #include <utility>
> #include <vector>
> #include <boost/range/iterator_range.hpp>
>
> int main()
> {
> std::pair<int,int> p(1,1);
> std::vector<std::pair<int,int> > v(2,p);
> boost::iterator_range<std::vector<int>::iterator> r(v.begin(), v.end());
> r[0].first; // ERROR
> }
>
> I get the following error:
>
> 1>c:\boost\org\trunk\libs\proto\scratch\main.cpp(10) : error C2039:
> 'first' : is not a member of
> 'boost::detail::operator_brackets_proxy<Iterator>'
>
> This is breaking Boost.Accumulators. Can you look into it?
>

Why are you using std::vector<int>::iterator, instead of
std::vector<std::pair<int, int> >::iterator? Regardless, it
probably shouldn't be using operator_brackets_proxy
when dealing with a real reference.

In Christ,
Steven Watanabe


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