|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r79432 - in trunk/libs/move: doc test
From: igaztanaga_at_[hidden]
Date: 2012-07-11 18:35:01
Author: igaztanaga
Date: 2012-07-11 18:35:00 EDT (Wed, 11 Jul 2012)
New Revision: 79432
URL: http://svn.boost.org/trac/boost/changeset/79432
Log:
Ticket #7031: (back_|front_)move_insert_iterator::op= cannot take rvalue
Text files modified:
trunk/libs/move/doc/move.qbk | 5 ++-
trunk/libs/move/test/back_move_inserter.cpp | 59 ++++++++++++++++++++++++---------------
2 files changed, 39 insertions(+), 25 deletions(-)
Modified: trunk/libs/move/doc/move.qbk
==============================================================================
--- trunk/libs/move/doc/move.qbk (original)
+++ trunk/libs/move/doc/move.qbk 2012-07-11 18:35:00 EDT (Wed, 11 Jul 2012)
@@ -789,8 +789,9 @@
[section:release_notes_boost_1_51_00 Boost 1.51 Release]
-* Fixed bug
- [@https://svn.boost.org/trac/boost/ticket/7095 #7095].
+* Fixed bugs
+ [@https://svn.boost.org/trac/boost/ticket/7095 #7095],
+ [@https://svn.boost.org/trac/boost/ticket/7031 #7031].
[endsect]
Modified: trunk/libs/move/test/back_move_inserter.cpp
==============================================================================
--- trunk/libs/move/test/back_move_inserter.cpp (original)
+++ trunk/libs/move/test/back_move_inserter.cpp 2012-07-11 18:35:00 EDT (Wed, 11 Jul 2012)
@@ -17,29 +17,42 @@
template<class Container>
int move_test()
{
- //Default construct 10 movable objects
- Container v(10);
-
- //Test default constructed value
- if(v.begin()->moved()){
- return 1;
- }
-
- //Move values
- Container v2;
- std::copy(v.begin(), v.end(), boost::back_move_inserter(v2));
-
- //Test values have been moved
- if(!v.begin()->moved()){
- return 1;
- }
-
- if(v2.size() != 10){
- return 1;
- }
-
- if(v2.begin()->moved()){
- return 1;
+ bool use_move_iterator = false;
+ bool done = false;
+ while(!done){
+ //Default construct 10 movable objects
+ Container v(10);
+
+ //Test default constructed value
+ if(v.begin()->moved()){
+ return 1;
+ }
+
+ //Move values
+ Container v2;
+ if(use_move_iterator){
+ ::boost::copy_or_move( boost::make_move_iterator(v.begin())
+ , boost::make_move_iterator(v.end())
+ , boost::back_move_inserter(v2));
+ }
+ else{
+ std::copy(v.begin(), v.end(), boost::back_move_inserter(v2));
+ }
+
+ //Test values have been moved
+ if(!v.begin()->moved()){
+ return 1;
+ }
+
+ if(v2.size() != 10){
+ return 1;
+ }
+
+ if(v2.begin()->moved()){
+ return 1;
+ }
+ done = use_move_iterator;
+ use_move_iterator = true;
}
return 0;
}
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