Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10514: Cannot copy const sub_range to non-const
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-02-02 02:27:40
#10514: Cannot copy const sub_range to non-const
-----------------------------------------+------------------------
Reporter: Braden McDaniel <braden@â¦> | Owner: neilgroves
Type: Bugs | Status: reopened
Milestone: To Be Determined | Component: range
Version: Boost 1.56.0 | Severity: Regression
Resolution: | Keywords:
-----------------------------------------+------------------------
Changes (by Braden McDaniel <braden@â¦>):
* status: closed => reopened
* resolution: invalid =>
Comment:
Replying to [comment:1 neilgroves]:
> The propagation of const-ness is the rationale for having sub_range in
addition to iterator_range. Please see:
http://www.boost.org/doc/libs/1_57_0/libs/range/doc/html/range/reference/utilities/sub_range.html
>
> If you do not wish to propagate const-ness please use iterator_range
instead.
It appears to me that `const` is being propagating incorrectly in this
case. At the very least, `const` is being propagated in a way that is
inconsistent with how it is normally propagated with the standard
containers. Consider the analogous example using just `std::vector`:
{{{#!c++
std::vector<int> v(10);
const std::vector<int> & v_ref = v;
std::vector<int> u = v_ref;
}}}
This compiles just fine because there is no problem copying a `const int`
to an `int`. To the point: it doesn't matter that `v_ref` uses
`const_iterator`s.
(So, I may have framed the problem incorrectly in my initial description.
The problem isn't that `const_iterator`s are being used at all; the
problem is that `sub_range` seems to insist that the lhs use
`const_iterator`s just because the rhs does.)
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10514#comment:2> 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:17 UTC