diff --git a/include/boost/container/detail/copy_move_algo.hpp b/include/boost/container/detail/copy_move_algo.hpp index 5ae5a04..23fa730 100644 --- a/include/boost/container/detail/copy_move_algo.hpp +++ b/include/boost/container/detail/copy_move_algo.hpp @@ -175,8 +175,10 @@ inline F memmove(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW { typedef typename boost::container::iterator_traits::value_type value_type; typename boost::container::iterator_traits::difference_type n = boost::container::iterator_distance(f, l); - std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n); - boost::container::iterator_advance(r, n); + if(n){ + std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n); + boost::container::iterator_advance(r, n); + } return r; } @@ -186,8 +188,10 @@ template F memmove_n(I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW { typedef typename boost::container::iterator_traits::value_type value_type; - std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n); - boost::container::iterator_advance(r, n); + if(n){ + std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n); + boost::container::iterator_advance(r, n); + } return r; } @@ -196,9 +200,11 @@ template typename F> // F models ForwardIterator I memmove_n_source(I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW { - typedef typename boost::container::iterator_traits::value_type value_type; - std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n); - boost::container::iterator_advance(f, n); + if(n){ + typedef typename boost::container::iterator_traits::value_type value_type; + std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n); + boost::container::iterator_advance(f, n); + } return f; } @@ -208,9 +214,11 @@ template I memmove_n_source_dest(I f, typename boost::container::iterator_traits::difference_type n, F &r) BOOST_NOEXCEPT_OR_NOTHROW { typedef typename boost::container::iterator_traits::value_type value_type; - std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n); - boost::container::iterator_advance(f, n); - boost::container::iterator_advance(r, n); + if(n){ + std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n); + boost::container::iterator_advance(f, n); + boost::container::iterator_advance(r, n); + } return f; } diff --git a/include/boost/container/small_vector.hpp b/include/boost/container/small_vector.hpp index 4c5a59c..a9f7522 100644 --- a/include/boost/container/small_vector.hpp +++ b/include/boost/container/small_vector.hpp @@ -60,7 +60,7 @@ class small_vector_base; //! for documentation purposes. //! //! This allocator inherits from a standard-conforming allocator -//! and forwards member functiond to the standard allocator except +//! and forwards member functions to the standard allocator except //! when internal storage is being used as memory source. //! //! This allocator is a "partially_propagable" allocator and @@ -68,7 +68,7 @@ class small_vector_base; //! //! A partially propagable allocator means that not all storage //! allocatod by an instance of `small_vector_allocator` can be -//! deallocated by another instance of this type, even is both +//! deallocated by another instance of this type, even if both //! instances compare equal or an instance is propagated to another //! one using the copy/move constructor or assignment. The storage that //! can never be propagated is identified by `storage_is_unpropagable(p)`. @@ -432,8 +432,8 @@ struct small_vector_storage_definer #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -//! small_vector a vector-like container optimized for the case when it contains few elements. -//! It contains some preallocated elements in-place, which allows it to avoid the use of dynamic storage allocation +//! small_vector is a vector-like container optimized for the case when it contains few elements. +//! It contains some preallocated elements in-place, which can avoid the use of dynamic storage allocation //! when the actual number of elements is below that preallocated threshold. //! //! `small_vector` is convertible to `small_vector_base` that is independent