Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79431 - trunk/boost/move
From: igaztanaga_at_[hidden]
Date: 2012-07-11 18:32:48


Author: igaztanaga
Date: 2012-07-11 18:32:47 EDT (Wed, 11 Jul 2012)
New Revision: 79431
URL: http://svn.boost.org/trac/boost/changeset/79431

Log:
Ticket #7031: (back_|front_)move_insert_iterator::op= cannot take rvalue
Text files modified:
   trunk/boost/move/move.hpp | 27 +++++++++++++++++++++------
   1 files changed, 21 insertions(+), 6 deletions(-)

Modified: trunk/boost/move/move.hpp
==============================================================================
--- trunk/boost/move/move.hpp (original)
+++ trunk/boost/move/move.hpp 2012-07-11 18:32:47 EDT (Wed, 11 Jul 2012)
@@ -812,13 +812,18 @@
    C* container_m;
 
    public:
- typedef C container_type;
+ typedef C container_type;
+ typedef typename C::value_type value_type;
+ typedef typename C::reference reference;
 
    explicit back_move_insert_iterator(C& x) : container_m(&x) { }
 
- back_move_insert_iterator& operator=(typename C::reference x)
+ back_move_insert_iterator& operator=(reference x)
    { container_m->push_back(boost::move(x)); return *this; }
 
+ back_move_insert_iterator& operator=(BOOST_RV_REF(value_type) x)
+ { reference rx = x; return this->operator=(rx); }
+
    back_move_insert_iterator& operator*() { return *this; }
    back_move_insert_iterator& operator++() { return *this; }
    back_move_insert_iterator& operator++(int) { return *this; }
@@ -847,13 +852,18 @@
    C* container_m;
 
 public:
- typedef C container_type;
+ typedef C container_type;
+ typedef typename C::value_type value_type;
+ typedef typename C::reference reference;
 
    explicit front_move_insert_iterator(C& x) : container_m(&x) { }
 
- front_move_insert_iterator& operator=(typename C::reference x)
+ front_move_insert_iterator& operator=(reference x)
    { container_m->push_front(boost::move(x)); return *this; }
 
+ front_move_insert_iterator& operator=(BOOST_RV_REF(value_type) x)
+ { reference rx = x; return this->operator=(rx); }
+
    front_move_insert_iterator& operator*() { return *this; }
    front_move_insert_iterator& operator++() { return *this; }
    front_move_insert_iterator& operator++(int) { return *this; }
@@ -880,19 +890,24 @@
    typename C::iterator pos_;
 
    public:
- typedef C container_type;
+ typedef C container_type;
+ typedef typename C::value_type value_type;
+ typedef typename C::reference reference;
 
    explicit move_insert_iterator(C& x, typename C::iterator pos)
       : container_m(&x), pos_(pos)
    {}
 
- move_insert_iterator& operator=(typename C::reference x)
+ move_insert_iterator& operator=(reference x)
    {
       pos_ = container_m->insert(pos_, ::boost::move(x));
       ++pos_;
       return *this;
    }
 
+ move_insert_iterator& operator=(BOOST_RV_REF(value_type) x)
+ { reference rx = x; return this->operator=(rx); }
+
    move_insert_iterator& operator*() { return *this; }
    move_insert_iterator& operator++() { return *this; }
    move_insert_iterator& operator++(int) { return *this; }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk