Re: [Boost-bugs] [Boost C++ Libraries] #7630: Range adaptors do not play nicely with range-based for loops

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7630: Range adaptors do not play nicely with range-based for loops
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-03-09 02:52:24


#7630: Range adaptors do not play nicely with range-based for loops
-------------------------------+------------------------
  Reporter: gromer@… | Owner: neilgroves
      Type: Bugs | Status: assigned
 Milestone: To Be Determined | Component: range
   Version: Boost 1.51.0 | Severity: Problem
Resolution: | Keywords: range
-------------------------------+------------------------

Comment (by nathanridge):

 Replying to [comment:13 neilgroves]:
> I don't think the provided example does suffer undefined behaviour. It
 doesn't matter that the subexpression lifetime is short since the
 subexpression was used as input to the outer expression. The outer
 expression holds iterators by value by copying them. It doesn't hold onto
 the source range as stated in the report.
>
> If one were to have a slightly different example with, for example, a
 vector returned by value from a function and then directly passed into the
 adaptors this would be undefined.

 Correct.

> I'm not convinced that this use case is worth the general penalty.

 I have run into this situation, and been bitten by the undefined
 behaviour, on a number of occasions. Move constructors are generally
 cheap, so I believe the general penalty for fixing this would be low.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7630#comment:14>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:15 UTC