summaryrefslogtreecommitdiff
path: root/boost/container/detail/copy_move_algo.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/container/detail/copy_move_algo.hpp')
-rw-r--r--boost/container/detail/copy_move_algo.hpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/boost/container/detail/copy_move_algo.hpp b/boost/container/detail/copy_move_algo.hpp
index 29d47ccbda..b71560d9e5 100644
--- a/boost/container/detail/copy_move_algo.hpp
+++ b/boost/container/detail/copy_move_algo.hpp
@@ -177,8 +177,7 @@ inline F memmove(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW
value_type *const dest_raw = boost::movelib::iterator_to_raw_pointer(r);
const value_type *const beg_raw = boost::movelib::iterator_to_raw_pointer(f);
const value_type *const end_raw = boost::movelib::iterator_to_raw_pointer(l);
- if(BOOST_LIKELY(beg_raw != end_raw)){
- BOOST_ASSERT(beg_raw != 0);
+ if(BOOST_LIKELY(beg_raw != end_raw && dest_raw && beg_raw)){
const typename boost::container::iterator_traits<I>::difference_type n = end_raw - beg_raw;
std::memmove(dest_raw, beg_raw, sizeof(value_type)*n);
boost::container::iterator_advance(r, n);
@@ -522,9 +521,9 @@ inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, I>::type
{
F back = r;
BOOST_TRY{
- while (n--) {
+ while (n) {
boost::container::construct_in_place(a, boost::movelib::iterator_to_raw_pointer(r), f);
- ++f; ++r;
+ ++f; ++r; --n;
}
}
BOOST_CATCH(...){