Opened 5 years ago

Closed 5 years ago

#7031 closed Bugs (fixed)

(back_|front_)move_insert_iterator::op= cannot take rvalue

Reported by: Kohei Takahashi <flast@…> Owned by: igaztanaga
Milestone: To Be Determined Component: move
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:


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));

Attachments (0)

Change History (1)

comment:1 Changed 5 years ago by igaztanaga

  • Resolution set to fixed
  • Status changed from new to closed

Thanks for the report, fixed in trunk at revision: 79431

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain igaztanaga.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.