Boost logo

Boost :

Subject: Re: [boost] [Range] Range adaptor approach for temporary range lifetime issue
From: Olaf van der Spek (ml_at_[hidden])
Date: 2012-06-24 08:46:01


On Sat, Jun 23, 2012 at 10:22 PM, Jeffrey Lee Hellrung, Jr.
<jeffrey.hellrung_at_[hidden]> wrote:
> On Sat, Jun 23, 2012 at 2:13 AM, Nathan Ridge <zeratul976_at_[hidden]>wrote:
>
>>
>> By the way, my first thought when I encountered this problem
>> is that C++11  ought to have specified the range-based for loop
>> in such a way that the lifetime of temporaries in the range
>> expression is extended for the duration of the loop.

Sounds like the simplest and most generic solution.
Does BOOST_FOREACH suffer from the same problem?

Olaf


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