
18 Jun
2012
18 Jun
'12
11:20 p.m.
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