|
Boost : |
Subject: Re: [boost] [Multiarray] & [Range] MSVC/gcc warning: returning address of local variable or temporary
From: Neil Groves (neil_at_[hidden])
Date: 2008-11-13 16:19:06
On Thu, Nov 13, 2008 at 2:25 AM, David Abrahams <dave_at_[hidden]> wrote:
>
> on Wed Nov 12 2008, Thorsten Ottosen <thorsten.ottosen-AT-dezide.com>
> wrote:
>
> > David Abrahams skrev:
> >> on Wed Nov 12 2008, Thorsten Ottosen <thorsten.ottosen-AT-dezide.com>
> 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. Maybe if it isn't, you could turn off
> >> whatever you're doing with enable_if or something. Why is
> >> iterator_range using the iterator's operator[], anyway?
> >
> > It seems very natural to be able to index a random access range,
> > doesn't it.
>
> No comment.
>
> > And how else would you implement that?
>
> The exact same way we implement it in iterator_facade.
>
>
> http://www.boost.org/doc/libs/1_37_0/libs/iterator/doc/iterator_facade.html#operator
>
I have the same issue in RangeEx. I would like to implement your suggestion.
Your code looks so fit for purpose that perhaps we should take
operator_brackets_proxy et al. out of the detail namespace and make it
common to iterator_facade and to iterator_range? I'm concerned I might be
being a little slow and that you are suggesting the use of already available
public boost APIs.
>
> > Anyway, I guess I could do that check. Is it illegal for the iterators
> > reference type to be a non-reference?
>
> No, but in C++03 that makes them input iterators or output iterators,
> but not forward iterators.
>
I would appreciate a further guidance. Thank you in anticipation for your
patience.
Neil Groves
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk