Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2006-10-11 17:40:45


Thorsten Ottosen <thorsten.ottosen_at_[hidden]> writes:

> Shunsuke Sogame wrote:
>> Hi gurus, under RC_1_34,
>>
>> #include <boost/range.hpp>
>> #include <boost/iterator/counting_iterator.hpp>
>>
>> int main()
>> {
>> boost::make_iterator_range(
>> boost::make_counting_iterator(0),
>> boost::make_counting_iterator(5)
>> )[2];
>> }
>>
>>
>> VC++7.1 and GCC3.4 says a warning something like
>> "returning address of local variable or temporary".
>>
>> counting_iterator is implemented by iterator_facade,
>> whose operator[] returns *value*.
>> In fact, the result type of iterator_facade's operator[] seems unspecified.
>> Is it possible to do forwarding of iterator's operator[], which is
>> tried by iterator_range?
>
> We could add operator() which would return operator[]()'s result by value.
>
> Is anybody opposed to that?

Probably. What is the point of doing that?

-- 
Dave Abrahams
Boost Consulting
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