Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5473: [Foreach] non-const rvalue collections are treated as const collections
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-11-05 13:03:58
#5473: [Foreach] non-const rvalue collections are treated as const collections
--------------------------------------+-------------------------------------
Reporter: mimomorin@⦠| Owner: eric_niebler
Type: Patches | Status: closed
Milestone: To Be Determined | Component: foreach
Version: Boost Development Trunk | Severity: Problem
Resolution: wontfix | Keywords:
--------------------------------------+-------------------------------------
Comment (by bernd.loerwald@â¦):
It actually is not non-sense.
Given a class being a facade container to an actual container, one might
construct the facade container on the fly:
values_type values() const { return values_type (*this); }
and use it in a manipulating way:
BOOST_FOREACH (elem_type& elem, values())
with values_type having non-const iterators, that iterate over the actual
container (which is referenced in values_type).
This will fail, as values() returns an rvalue, thus only const iteration
is possible. It would be perfectly valid to modify the elements iterated
over with the facade.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5473#comment:5> 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:11 UTC