Boost logo

Boost :

Subject: Re: [boost] [Multiarray] & [Range] MSVC/gcc warning: returning address of local variable or temporary
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-11-12 16:59:58


Steven Watanabe skrev:
> AMDG
>
> David Abrahams wrote:
>>> Do you mean that I can detect the return type of operator[] at
>>> compile-time and do correct forwarding?
>>
>> No, I mean you can detect when the return type of operator[] is the same
>> as the reference type.
>
> How do you distinguish const T& from T?
> If T is large, it is not necessarily a good idea
> to make extraneous copies if they can be avoided.
> Unlike iterator_facade, iterator_range doesn't
> make it easy to replace its version of operator[]...

I provided operator() for use when pass by value must be used.

-Thorsten


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