Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82206 - trunk/boost/move
From: igaztanaga_at_[hidden]
Date: 2012-12-25 18:07:02


Author: igaztanaga
Date: 2012-12-25 18:07:01 EST (Tue, 25 Dec 2012)
New Revision: 82206
URL: http://svn.boost.org/trac/boost/changeset/82206

Log:
Fixes #7830
Text files modified:
   trunk/boost/move/algorithm.hpp | 19 ++++++++++++++++---
   1 files changed, 16 insertions(+), 3 deletions(-)

Modified: trunk/boost/move/algorithm.hpp
==============================================================================
--- trunk/boost/move/algorithm.hpp (original)
+++ trunk/boost/move/algorithm.hpp 2012-12-25 18:07:01 EST (Tue, 25 Dec 2012)
@@ -19,6 +19,7 @@
 #include <boost/move/utility.hpp>
 #include <boost/move/iterator.hpp>
 #include <boost/move/algorithm.hpp>
+#include <boost/detail/no_exceptions_support.hpp>
 
 #include <algorithm> //copy, copy_backward
 #include <memory> //uninitialized_copy
@@ -110,10 +111,22 @@
    )
 {
    typedef typename std::iterator_traits<I>::value_type input_value_type;
- while (f != l) {
- ::new(static_cast<void*>(&*r)) input_value_type(boost::move(*f));
- ++f; ++r;
+
+ F back = r;
+ BOOST_TRY{
+ while (f != l) {
+ void * const addr = static_cast<void*>(::boost::move_detail::addressof(*r));
+ ::new(addr) input_value_type(::boost::move(*f));
+ ++f; ++r;
+ }
+ }
+ BOOST_CATCH(...){
+ for (; back != r; ++back){
+ back->~input_value_type();
+ }
+ BOOST_RETHROW;
    }
+ BOOST_CATCH_END
    return r;
 }
 


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