[Boost-bugs] [Boost C++ Libraries] #7031: (back_|front_)move_insert_iterator::op= cannot take rvalue

Subject: [Boost-bugs] [Boost C++ Libraries] #7031: (back_|front_)move_insert_iterator::op= cannot take rvalue
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-06-26 19:46:49


#7031: (back_|front_)move_insert_iterator::op= cannot take rvalue
----------------------------------------------+-----------------------------
 Reporter: Kohei Takahashi <flast@…> | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: move
  Version: Boost Development Trunk | Severity: Problem
 Keywords: |
----------------------------------------------+-----------------------------
 For example, following code occurs compile error both of C++03 and C++11.
 {{{
 vector<movable_type> container;
 *boost::back_move_inserter(container) = movable_type();
 *boost::front_move_inserter(container) = movable_type();
 *boost::move_inserter(container, container.end()) = movable_type();
 }}}

 Another example, following code also occurs compile error in C++11 (does
 not C++03).
 {{{
 vector<movable_type> container;
 movable_type v;
 *boost::back_move_inserter(container) = boost::move(v);
 *boost::front_move_inserter(container) = boost::move(v);
 *boost::move_inserter(container, container.end()) = boost::move(v);
 }}}

 It seems missing definition of
 (back_|front_)move_insert_iterator::op=(C::value_type &&) .

 The simple patch is here, and I tested under only trunk, r79106.
 {{{
 @@ -817,6 +817,8 @@ class back_move_insert_iterator
     explicit back_move_insert_iterator(C& x) : container_m(&x) { }

     back_move_insert_iterator& operator=(typename C::reference x)
 + { return operator=(boost::move(x)); }
 + back_move_insert_iterator& operator=(BOOST_RV_REF(typename
 C::value_type) x)
     { container_m->push_back(boost::move(x)); return *this; }

     back_move_insert_iterator& operator*() { return *this; }
 @@ -852,6 +854,8 @@ public:
     explicit front_move_insert_iterator(C& x) : container_m(&x) { }

     front_move_insert_iterator& operator=(typename C::reference x)
 + { return operator=(boost::move(x)); }
 + front_move_insert_iterator& operator=(BOOST_RV_REF(typename
 C::value_type) x)
     { container_m->push_front(boost::move(x)); return *this; }

     front_move_insert_iterator& operator*() { return *this; }
 @@ -887,6 +891,8 @@ class move_insert_iterator
     {}

     move_insert_iterator& operator=(typename C::reference x)
 + { return operator=(boost::move(x)); }
 + move_insert_iterator& operator=(BOOST_RV_REF(typename C::value_type)
 x)
     {
        pos_ = container_m->insert(pos_, ::boost::move(x));
        ++pos_;
 }}}

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