|
Boost : |
Subject: Re: [boost] [Range] Range adaptor approach for temporary range lifetime issue
From: Michel Morin (mimomorin_at_[hidden])
Date: 2012-06-18 19:20:11
Thorsten Ottosen wrote:
>> Side note:
>>
>> * There is also a fully automatic approach (i.e. when an rvalue range
>> is adapted,
>> `moved_range` is automatically used without piping it to `moved` adaptor).
>> But this approach incurs unnecessary overhead when passing them to
>> functions,
>> because function arguments do not have the lifetime issue and we don't
>> need
>> to use `moved_range`.
>
>
> I'm not sure this is true, that is, that sub-expressions of function
> arguments are guaranteed not to be destroyed before the function ends.
Temporary objects are valid until the end of the full-expression.
See 12.2 [class.temporary] p3 in the Standard.
Regards,
Michel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk