[Boost-bugs] [Boost C++ Libraries] #5816: any_range requires copyable elements

Subject: [Boost-bugs] [Boost C++ Libraries] #5816: any_range requires copyable elements
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-08-27 18:10:20


#5816: any_range requires copyable elements
-------------------------------+--------------------------------------------
 Reporter: bromeon@… | Owner: neilgroves
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: range
  Version: Boost 1.47.0 | Severity: Problem
 Keywords: |
-------------------------------+--------------------------------------------
 boost::any_range attempts to copy container elements even if the
 ''Reference'' template parameter is a reference. This behavior prevents
 the use of noncopyable element types and is inconsistent with
 boost::sub_range and boost::iterator_range.

 Short code example that doesn't compile (unless ''private:'' is commented
 out):
 {{{
 #include <boost/range/concepts.hpp> // because any_range.hpp doesn't
 compile alone
 #include <boost/range/any_range.hpp>
 #include <vector>

 // X is movable, but non-copyable
 class X
 {
     public:
         X() {}
         X(X&&) {}
         void operator= (X&&) {}

     private:
         X(const X&);
         void operator= (const X&);
 };

 int main()
 {
     std::vector<X> v;
     boost::any_range<X, boost::random_access_traversal_tag, X&,
 std::ptrdiff_t> range2 = v;
 }
 }}}

 The problem might be in line 429 of any_iterator_wrapper.hpp, where
 ''reference_as_value_type'' is used for the ''Reference'' template
 parameter of the underlying ''any_random_access_iterator_wrapper''.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5816>
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:07 UTC