diff --git a/bench/bench_set.hpp b/bench/bench_set.hpp index cdc3043..1e70250 100644 --- a/bench/bench_set.hpp +++ b/bench/bench_set.hpp @@ -13,7 +13,7 @@ #include #include -#include +#include //sort #include #include #include diff --git a/bench/detail/varray.hpp b/bench/detail/varray.hpp index 244c34d..dd01646 100644 --- a/bench/detail/varray.hpp +++ b/bench/detail/varray.hpp @@ -18,15 +18,12 @@ #include #include #include - +#include //algo_equal(), algo_lexicographical_compare +#include #include #include "varray_util.hpp" -#ifndef BOOST_NO_EXCEPTIONS -#include -#endif // BOOST_NO_EXCEPTIONS - #include #include #include @@ -38,6 +35,10 @@ #include #include +#ifndef BOOST_NO_EXCEPTIONS +#include +#endif // BOOST_NO_EXCEPTIONS + /** * @defgroup varray_non_member varray non-member functions @@ -268,9 +269,9 @@ public: //! @brief The const iterator type. typedef const_pointer const_iterator; //! @brief The reverse iterator type. - typedef container_detail::reverse_iterator reverse_iterator; + typedef boost::container::reverse_iterator reverse_iterator; //! @brief The const reverse iterator. - typedef container_detail::reverse_iterator const_reverse_iterator; + typedef boost::container::reverse_iterator const_reverse_iterator; //! @brief The type of a strategy used by the varray. typedef Strategy strategy_type; @@ -836,7 +837,7 @@ public: { namespace sv = varray_detail; - difference_type to_move = std::distance(position, this->end()); + difference_type to_move = boost::container::iterator_distance(position, this->end()); // TODO - should following lines check for exception and revert to the old size? @@ -883,7 +884,7 @@ public: template iterator insert(iterator position, Iterator first, Iterator last) { - typedef typename std::iterator_traits::iterator_category category; + typedef typename boost::container::iterator_traits::iterator_category category; this->insert_dispatch(position, first, last, category()); return position; @@ -937,7 +938,7 @@ public: errh::check_iterator_end_eq(*this, first); errh::check_iterator_end_eq(*this, last); - difference_type n = std::distance(first, last); + difference_type n = boost::container::iterator_distance(first, last); //TODO - add invalid range check? //BOOST_ASSERT_MSG(0 <= n, "invalid range"); @@ -966,7 +967,7 @@ public: template void assign(Iterator first, Iterator last) { - typedef typename std::iterator_traits::iterator_category category; + typedef typename boost::container::iterator_traits::iterator_category category; this->assign_dispatch(first, last, category()); // may throw } @@ -1632,7 +1633,7 @@ private: // Linear O(N). void swap_dispatch_impl(iterator first_sm, iterator last_sm, iterator first_la, iterator last_la, boost::true_type const& /*use_memop*/) { - //BOOST_ASSERT_MSG(std::distance(first_sm, last_sm) <= std::distance(first_la, last_la)); + //BOOST_ASSERT_MSG(boost::container::iterator_distance(first_sm, last_sm) <= boost::container::iterator_distance(first_la, last_la)); namespace sv = varray_detail; for (; first_sm != last_sm ; ++first_sm, ++first_la) @@ -1648,7 +1649,7 @@ private: ::memcpy(boost::addressof(*first_la), temp_ptr, sizeof(value_type)); } - ::memcpy(first_sm, first_la, sizeof(value_type) * std::distance(first_la, last_la)); + ::memcpy(first_sm, first_la, sizeof(value_type) * boost::container::iterator_distance(first_la, last_la)); } // @par Throws @@ -1657,7 +1658,7 @@ private: // Linear O(N). void swap_dispatch_impl(iterator first_sm, iterator last_sm, iterator first_la, iterator last_la, boost::false_type const& /*use_memop*/) { - //BOOST_ASSERT_MSG(std::distance(first_sm, last_sm) <= std::distance(first_la, last_la)); + //BOOST_ASSERT_MSG(boost::container::iterator_distance(first_sm, last_sm) <= boost::container::iterator_distance(first_la, last_la)); namespace sv = varray_detail; for (; first_sm != last_sm ; ++first_sm, ++first_la) @@ -1719,8 +1720,7 @@ private: { errh::check_iterator_end_eq(*this, position); - typename boost::iterator_difference::type - count = std::distance(first, last); + size_type count = boost::container::iterator_distance(first, last); errh::check_capacity(*this, m_size + count); // may throw @@ -1751,7 +1751,7 @@ private: { namespace sv = varray_detail; - std::ptrdiff_t d = std::distance(position, this->begin() + Capacity); + std::ptrdiff_t d = boost::container::iterator_distance(position, this->begin() + Capacity); std::size_t count = sv::uninitialized_copy_s(first, last, position, d); // may throw errh::check_capacity(*this, count <= static_cast(d) ? m_size + count : Capacity + 1); // may throw @@ -1760,8 +1760,7 @@ private: } else { - typename boost::iterator_difference::type - count = std::distance(first, last); + size_type count = boost::container::iterator_distance(first, last); errh::check_capacity(*this, m_size + count); // may throw @@ -1779,7 +1778,7 @@ private: { namespace sv = varray_detail; - difference_type to_move = std::distance(position, this->end()); + difference_type to_move = boost::container::iterator_distance(position, this->end()); // TODO - should following lines check for exception and revert to the old size? @@ -1793,7 +1792,7 @@ private: else { Iterator middle_iter = first; - std::advance(middle_iter, to_move); + boost::container::iterator_advance(middle_iter, to_move); sv::uninitialized_copy(middle_iter, last, this->end()); // may throw m_size += count - to_move; // update end @@ -1814,8 +1813,7 @@ private: { namespace sv = varray_detail; - typename boost::iterator_difference::type - s = std::distance(first, last); + size_type s = boost::container::iterator_distance(first, last); errh::check_capacity(*this, s); // may throw @@ -1850,7 +1848,7 @@ private: sv::destroy(it, this->end()); - std::ptrdiff_t d = std::distance(it, this->begin() + Capacity); + std::ptrdiff_t d = boost::container::iterator_distance(it, this->begin() + Capacity); std::size_t count = sv::uninitialized_copy_s(first, last, it, d); // may throw s += count; @@ -1896,8 +1894,8 @@ public: typedef pointer iterator; typedef const_pointer const_iterator; - typedef container_detail::reverse_iterator reverse_iterator; - typedef container_detail::reverse_iterator const_reverse_iterator; + typedef boost::container::reverse_iterator reverse_iterator; + typedef boost::container::reverse_iterator const_reverse_iterator; // nothrow varray() {} @@ -1931,7 +1929,7 @@ public: template varray(Iterator first, Iterator last) { - errh::check_capacity(*this, std::distance(first, last)); // may throw + errh::check_capacity(*this, boost::container::iterator_distance(first, last)); // may throw } // basic @@ -2001,7 +1999,7 @@ public: template void insert(iterator, Iterator first, Iterator last) { - errh::check_capacity(*this, std::distance(first, last)); // may throw + errh::check_capacity(*this, boost::container::iterator_distance(first, last)); // may throw } // basic @@ -2023,7 +2021,7 @@ public: template void assign(Iterator first, Iterator last) { - errh::check_capacity(*this, std::distance(first, last)); // may throw + errh::check_capacity(*this, boost::container::iterator_distance(first, last)); // may throw } // basic @@ -2145,7 +2143,7 @@ private: template bool operator== (varray const& x, varray const& y) { - return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin()); + return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } //! @brief Checks if contents of two varrays are not equal. @@ -2179,7 +2177,7 @@ bool operator!= (varray const& x, varray const& y) template bool operator< (varray const& x, varray const& y) { - return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); + return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } //! @brief Lexicographically compares varrays. diff --git a/bench/detail/varray_util.hpp b/bench/detail/varray_util.hpp index d76d13f..04b9383 100644 --- a/bench/detail/varray_util.hpp +++ b/bench/detail/varray_util.hpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include @@ -113,10 +113,10 @@ struct are_corresponding : ::boost::mpl::and_< ::boost::is_same< ::boost::remove_const< - typename ::boost::iterator_value::type + typename ::boost::container::iterator_traits::value_type >, ::boost::remove_const< - typename ::boost::iterator_value::type + typename ::boost::container::iterator_traits::value_type > >, are_elements_contiguous, @@ -128,7 +128,7 @@ template struct is_corresponding_value : ::boost::is_same< ::boost::remove_const< - typename ::boost::iterator_value::type + typename ::boost::container::iterator_traits::value_type >, ::boost::remove_const > @@ -145,7 +145,7 @@ template void destroy_dispatch(I first, I last, boost::false_type const& /*has_trivial_destructor*/) { - typedef typename boost::iterator_value::type value_type; + typedef typename ::boost::container::iterator_traits::value_type value_type; for ( ; first != last ; ++first ) first->~value_type(); } @@ -153,7 +153,7 @@ void destroy_dispatch(I first, I last, template void destroy(I first, I last) { - typedef typename boost::iterator_value::type value_type; + typedef typename ::boost::container::iterator_traits::value_type value_type; destroy_dispatch(first, last, has_trivial_destructor()); } @@ -168,14 +168,14 @@ template void destroy_dispatch(I pos, boost::false_type const& /*has_trivial_destructor*/) { - typedef typename boost::iterator_value::type value_type; + typedef typename ::boost::container::iterator_traits::value_type value_type; pos->~value_type(); } template void destroy(I pos) { - typedef typename boost::iterator_value::type value_type; + typedef typename ::boost::container::iterator_traits::value_type value_type; destroy_dispatch(pos, has_trivial_destructor()); } @@ -185,11 +185,10 @@ template inline O copy_dispatch(I first, I last, O dst, boost::mpl::bool_ const& /*use_memmove*/) { - typedef typename boost::iterator_value::type value_type; - typename boost::iterator_difference::type d = std::distance(first, last); - - ::memmove(boost::addressof(*dst), boost::addressof(*first), sizeof(value_type) * d); - return dst + d; + typedef typename ::boost::container::iterator_traits::value_type value_type; + const std::size_t d = boost::container::iterator_distance(first, last); + ::memmove(boost::addressof(*dst), boost::addressof(*first), sizeof(value_type) * d); + return dst + d; } template @@ -206,7 +205,7 @@ inline O copy(I first, I last, O dst) ::boost::mpl::and_< are_corresponding, ::boost::has_trivial_assign< - typename ::boost::iterator_value::type + typename ::boost::container::iterator_traits::value_type > >::type use_memmove; @@ -221,11 +220,10 @@ inline O uninitialized_copy_dispatch(I first, I last, O dst, boost::mpl::bool_ const& /*use_memcpy*/) { - typedef typename boost::iterator_value::type value_type; - typename boost::iterator_difference::type d = std::distance(first, last); - - ::memcpy(boost::addressof(*dst), boost::addressof(*first), sizeof(value_type) * d); - return dst + d; + typedef typename ::boost::container::iterator_traits::value_type value_type; + const std::size_t d = boost::container::iterator_distance(first, last); + ::memcpy(boost::addressof(*dst), boost::addressof(*first), sizeof(value_type) * d); + return dst + d; } template @@ -244,7 +242,7 @@ F uninitialized_copy(I first, I last, F dst) ::boost::mpl::and_< are_corresponding, ::boost::has_trivial_copy< - typename ::boost::iterator_value::type + typename ::boost::container::iterator_traits::value_type > >::type use_memcpy; @@ -259,11 +257,10 @@ inline O uninitialized_move_dispatch(I first, I last, O dst, boost::mpl::bool_ const& /*use_memcpy*/) { - typedef typename boost::iterator_value::type value_type; - typename boost::iterator_difference::type d = std::distance(first, last); - - ::memcpy(boost::addressof(*dst), boost::addressof(*first), sizeof(value_type) * d); - return dst + d; + typedef typename ::boost::container::iterator_traits::value_type value_type; + const std::size_t d = boost::container::iterator_distance(first, last); + ::memcpy(boost::addressof(*dst), boost::addressof(*first), sizeof(value_type) * d); + return dst + d; } template @@ -277,7 +274,7 @@ O uninitialized_move_dispatch(I first, I last, O dst, BOOST_TRY { - typedef typename std::iterator_traits::value_type value_type; + typedef typename boost::container::iterator_traits::value_type value_type; for (; first != last; ++first, ++o ) new (boost::addressof(*o)) value_type(boost::move(*first)); } @@ -295,16 +292,16 @@ template inline O uninitialized_move(I first, I last, O dst) { - typedef typename - ::boost::mpl::and_< - are_corresponding, - ::boost::has_trivial_copy< - typename ::boost::iterator_value::type - > - >::type - use_memcpy; + typedef typename + ::boost::mpl::and_< + are_corresponding, + ::boost::has_trivial_copy< + typename ::boost::container::iterator_traits::value_type + > + >::type + use_memcpy; - return uninitialized_move_dispatch(first, last, dst, use_memcpy()); // may throw + return uninitialized_move_dispatch(first, last, dst, use_memcpy()); // may throw } // TODO - move uses memmove - implement 2nd version using memcpy? @@ -316,11 +313,10 @@ inline O move_dispatch(I first, I last, O dst, boost::mpl::bool_ const& /*use_memmove*/) { - typedef typename boost::iterator_value::type value_type; - typename boost::iterator_difference::type d = std::distance(first, last); - - ::memmove(boost::addressof(*dst), boost::addressof(*first), sizeof(value_type) * d); - return dst + d; + typedef typename ::boost::container::iterator_traits::value_type value_type; + const std::size_t d = boost::container::iterator_distance(first, last); + ::memmove(boost::addressof(*dst), boost::addressof(*first), sizeof(value_type)*d ); + return dst + d; } template @@ -328,23 +324,23 @@ inline O move_dispatch(I first, I last, O dst, boost::mpl::bool_ const& /*use_memmove*/) { - return boost::move(first, last, dst); // may throw + return boost::move(first, last, dst); // may throw } template inline O move(I first, I last, O dst) { - typedef typename - ::boost::mpl::and_< - are_corresponding, - ::boost::has_trivial_assign< - typename ::boost::iterator_value::type - > - >::type - use_memmove; + typedef typename + ::boost::mpl::and_< + are_corresponding, + ::boost::has_trivial_assign< + typename ::boost::container::iterator_traits::value_type + > + >::type + use_memmove; - return move_dispatch(first, last, dst, use_memmove()); // may throw + return move_dispatch(first, last, dst, use_memmove()); // may throw } // move_backward(BDI, BDI, BDO) @@ -354,9 +350,8 @@ inline BDO move_backward_dispatch(BDI first, BDI last, BDO dst, boost::mpl::bool_ const& /*use_memmove*/) { - typedef typename boost::iterator_value::type value_type; - typename boost::iterator_difference::type d = std::distance(first, last); - + typedef typename ::boost::container::iterator_traits::value_type value_type; + const std::size_t d = boost::container::iterator_distance(first, last); BDO foo(dst - d); ::memmove(boost::addressof(*foo), boost::addressof(*first), sizeof(value_type) * d); return foo; @@ -378,7 +373,7 @@ BDO move_backward(BDI first, BDI last, BDO dst) ::boost::mpl::and_< are_corresponding, ::boost::has_trivial_assign< - typename ::boost::iterator_value::type + typename ::boost::container::iterator_traits::value_type > >::type use_memmove; @@ -417,7 +412,7 @@ inline O uninitialized_move_if_noexcept(I first, I last, O dst) { typedef typename has_nothrow_move< - typename ::boost::iterator_value::type + typename ::boost::container::iterator_traits::value_type >::type use_move; return uninitialized_move_if_noexcept_dispatch(first, last, dst, use_move()); // may throw @@ -440,7 +435,7 @@ inline O move_if_noexcept(I first, I last, O dst) { typedef typename has_nothrow_move< - typename ::boost::iterator_value::type + typename ::boost::container::iterator_traits::value_type >::type use_move; return move_if_noexcept_dispatch(first, last, dst, use_move()); // may throw @@ -461,7 +456,7 @@ void uninitialized_fill_dispatch(I first, I last, boost::true_type const& /*has_trivial_constructor*/, boost::false_type const& /*disable_trivial_init*/) { - typedef typename boost::iterator_value::type value_type; + typedef typename ::boost::container::iterator_traits::value_type value_type; for ( ; first != last ; ++first ) new (boost::addressof(*first)) value_type(); } @@ -472,7 +467,7 @@ void uninitialized_fill_dispatch(I first, I last, boost::false_type const& /*has_trivial_constructor*/, DisableTrivialInit const& /*not_used*/) { - typedef typename boost::iterator_value::type value_type; + typedef typename ::boost::container::iterator_traits::value_type value_type; I it = first; BOOST_TRY @@ -492,7 +487,7 @@ template inline void uninitialized_fill(I first, I last, DisableTrivialInit const& disable_trivial_init) { - typedef typename boost::iterator_value::type value_type; + typedef typename ::boost::container::iterator_traits::value_type value_type; uninitialized_fill_dispatch(first, last, boost::has_trivial_constructor(), disable_trivial_init); // may throw } @@ -507,7 +502,7 @@ template inline void construct_dispatch(boost::mpl::bool_ const& /*dont_init*/, I pos) { - typedef typename ::boost::iterator_value::type value_type; + typedef typename ::boost::container::iterator_traits::value_type value_type; new (static_cast(::boost::addressof(*pos))) value_type(); // may throw } @@ -515,7 +510,7 @@ template inline void construct(DisableTrivialInit const&, I pos) { - typedef typename ::boost::iterator_value::type value_type; + typedef typename ::boost::container::iterator_traits::value_type value_type; typedef typename ::boost::mpl::and_< boost::has_trivial_constructor, DisableTrivialInit @@ -539,7 +534,7 @@ inline void construct_dispatch(I pos, P const& p, boost::mpl::bool_ const& /*use_memcpy*/) { - typedef typename boost::iterator_value::type V; + typedef typename ::boost::container::iterator_traits::value_type V; new (static_cast(boost::addressof(*pos))) V(p); // may throw } @@ -564,7 +559,7 @@ template inline void construct(DisableTrivialInit const&, I pos, BOOST_RV_REF(P) p) { - typedef typename boost::iterator_value::type V; + typedef typename ::boost::container::iterator_traits::value_type V; new (static_cast(boost::addressof(*pos))) V(::boost::move(p)); // may throw } @@ -579,7 +574,7 @@ void construct(DisableTrivialInit const&, I pos, BOOST_FWD_REF(Args) ...args) { - typedef typename boost::iterator_value::type V; + typedef typename ::boost::container::iterator_traits::value_type V; new (static_cast(boost::addressof(*pos))) V(::boost::forward(args)...); // may throw } @@ -597,7 +592,7 @@ void construct(DisableTrivialInit const&, BOOST_CONTAINER_PP_PARAM(P, p) \ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ { \ - typedef typename boost::iterator_value::type V; \ + typedef typename ::boost::container::iterator_traits::value_type V; \ new \ (static_cast(boost::addressof(*pos))) \ V(p, BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); /*may throw*/ \ diff --git a/include/boost/container/adaptive_pool.hpp b/include/boost/container/adaptive_pool.hpp index c12d511..02af997 100644 --- a/include/boost/container/adaptive_pool.hpp +++ b/include/boost/container/adaptive_pool.hpp @@ -32,8 +32,7 @@ #include #include #include -#include -#include +#include #include diff --git a/include/boost/container/deque.hpp b/include/boost/container/deque.hpp index 738a753..adf7e63 100644 --- a/include/boost/container/deque.hpp +++ b/include/boost/container/deque.hpp @@ -24,11 +24,9 @@ #include #include #include -#include -#include +#include + #include -#include -#include #include #include #include @@ -41,8 +39,12 @@ #include #include #include +#include //algo_equal(), algo_lexicographical_compare #include +#include + +#include //std::allocator #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include #endif @@ -353,10 +355,10 @@ class deque_base void swap_members(deque_base &x) BOOST_CONTAINER_NOEXCEPT { - std::swap(this->members_.m_start, x.members_.m_start); - std::swap(this->members_.m_finish, x.members_.m_finish); - std::swap(this->members_.m_map, x.members_.m_map); - std::swap(this->members_.m_map_size, x.members_.m_map_size); + ::boost::container::swap_dispatch(this->members_.m_start, x.members_.m_start); + ::boost::container::swap_dispatch(this->members_.m_finish, x.members_.m_finish); + ::boost::container::swap_dispatch(this->members_.m_map, x.members_.m_map); + ::boost::container::swap_dispatch(this->members_.m_map_size, x.members_.m_map_size); } void priv_initialize_map(size_type num_elements) @@ -504,8 +506,8 @@ class deque : protected deque_base typedef BOOST_CONTAINER_IMPDEF(allocator_type) stored_allocator_type; typedef BOOST_CONTAINER_IMPDEF(typename Base::iterator) iterator; typedef BOOST_CONTAINER_IMPDEF(typename Base::const_iterator) const_iterator; - typedef BOOST_CONTAINER_IMPDEF(container_detail::reverse_iterator) reverse_iterator; - typedef BOOST_CONTAINER_IMPDEF(container_detail::reverse_iterator) const_reverse_iterator; + typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator) reverse_iterator; + typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator) const_reverse_iterator; #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -604,7 +606,7 @@ class deque : protected deque_base ) : Base(a) { - typedef typename std::iterator_traits::iterator_category ItCat; + typedef typename boost::container::iterator_traits::iterator_category ItCat; this->priv_range_initialize(first, last, ItCat()); } @@ -825,10 +827,10 @@ class deque : protected deque_base >::type * = 0 ) { - const size_type len = std::distance(first, last); + const size_type len = boost::container::iterator_distance(first, last); if (len > size()) { FwdIt mid = first; - std::advance(mid, this->size()); + boost::container::iterator_advance(mid, this->size()); boost::container::copy(first, mid, begin()); this->insert(this->cend(), mid, last); } @@ -1476,7 +1478,7 @@ class deque : protected deque_base //! Throws: If memory allocation throws, T's constructor from a //! dereferenced InIt throws or T's copy constructor throws. //! - //! Complexity: Linear to std::distance [first, last). + //! Complexity: Linear to distance [first, last). template iterator insert(const_iterator pos, InIt first, InIt last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) @@ -1507,7 +1509,7 @@ class deque : protected deque_base //! Throws: If memory allocation throws, T's constructor from a //! dereferenced std::initializer_list throws or T's copy constructor throws. //! - //! Complexity: Linear to std::distance [il.begin(), il.end()). + //! Complexity: Linear to distance [il.begin(), il.end()). iterator insert(const_iterator pos, std::initializer_list il) { return insert(pos, il.begin(), il.end()); } #endif @@ -1524,7 +1526,7 @@ class deque : protected deque_base ) { container_detail::insert_range_proxy proxy(first); - return priv_insert_aux_impl(p, (size_type)std::distance(first, last), proxy); + return priv_insert_aux_impl(p, boost::container::iterator_distance(first, last), proxy); } #endif @@ -1667,7 +1669,7 @@ class deque : protected deque_base //! //! Complexity: Linear to the number of elements in the container. friend bool operator==(const deque& x, const deque& y) - { return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin()); } + { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } //! Effects: Returns true if x and y are unequal //! @@ -1679,7 +1681,7 @@ class deque : protected deque_base //! //! Complexity: Linear to the number of elements in the container. friend bool operator<(const deque& x, const deque& y) - { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } //! Effects: Returns true if x is greater than y //! @@ -1979,7 +1981,7 @@ class deque : protected deque_base void priv_range_initialize(FwdIt first, FwdIt last, std::forward_iterator_tag) { size_type n = 0; - n = std::distance(first, last); + n = boost::container::iterator_distance(first, last); this->priv_initialize_map(n); index_pointer cur_node; @@ -1988,7 +1990,7 @@ class deque : protected deque_base cur_node < this->members_.m_finish.m_node; ++cur_node) { FwdIt mid = first; - std::advance(mid, this->s_buffer_size()); + boost::container::iterator_advance(mid, this->s_buffer_size()); ::boost::container::uninitialized_copy_alloc(this->alloc(), first, mid, *cur_node); first = mid; } diff --git a/include/boost/container/detail/advanced_insert_int.hpp b/include/boost/container/detail/advanced_insert_int.hpp index a35279d..528ec4d 100644 --- a/include/boost/container/detail/advanced_insert_int.hpp +++ b/include/boost/container/detail/advanced_insert_int.hpp @@ -25,8 +25,9 @@ #include #include #include +#include #include -#include //std::iterator_traits + #include #include @@ -186,13 +187,13 @@ struct insert_move_proxy }; template -insert_move_proxy get_insert_value_proxy(BOOST_RV_REF(typename std::iterator_traits::value_type) v) +insert_move_proxy get_insert_value_proxy(BOOST_RV_REF(typename boost::container::iterator_traits::value_type) v) { return insert_move_proxy(v); } template -insert_copy_proxy get_insert_value_proxy(const typename std::iterator_traits::value_type &v) +insert_copy_proxy get_insert_value_proxy(const typename boost::container::iterator_traits::value_type &v) { return insert_copy_proxy(v); } diff --git a/include/boost/container/detail/algorithm.hpp b/include/boost/container/detail/algorithm.hpp new file mode 100644 index 0000000..bb1854d --- /dev/null +++ b/include/boost/container/detail/algorithm.hpp @@ -0,0 +1,60 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2014-2014. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DETAIL_ALGORITHM_HPP +#define BOOST_CONTAINER_DETAIL_ALGORITHM_HPP + +#if defined(_MSC_VER) +# pragma once +#endif + +namespace boost { +namespace container { + +template +bool algo_equal(InputIt1 first1, InputIt1 last1, InputIt2 first2) +{ + for (; first1 != last1; ++first1, ++first2) { + if (!(*first1 == *first2)) { + return false; + } + } + return true; +} + +template +bool algo_equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, BinaryPredicate p) +{ + for (; first1 != last1; ++first1, ++first2) { + if (!p(*first1, *first2)) { + return false; + } + } + return true; +} + +template + bool algo_lexicographical_compare (InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2) +{ + while (first1 != last1){ + if (first2 == last2 || *first2 < *first1) return false; + else if (*first1 < *first2) return true; + ++first1; ++first2; + } + return (first2 != last2); +} + +} //namespace container { +} //namespace boost { + +#endif //#ifndef BOOST_CONTAINER_DETAIL_ALGORITHM_HPP diff --git a/include/boost/container/detail/algorithms.hpp b/include/boost/container/detail/construct_in_place.hpp similarity index 81% rename from include/boost/container/detail/algorithms.hpp rename to include/boost/container/detail/construct_in_place.hpp index af15f65..6314b72 100644 --- a/include/boost/container/detail/algorithms.hpp +++ b/include/boost/container/detail/construct_in_place.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2013. +// (C) Copyright Ion Gaztanaga 2014-2014. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -10,15 +10,13 @@ // ////////////////////////////////////////////////////////////////////////////// -#ifndef BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP -#define BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP +#ifndef BOOST_CONTAINER_DETAIL_CONSTRUCT_IN_PLACE_HPP +#define BOOST_CONTAINER_DETAIL_CONSTRUCT_IN_PLACE_HPP #if defined(_MSC_VER) # pragma once #endif -#include -#include #include #include @@ -56,7 +54,5 @@ inline void construct_in_place(A &a, T *dest, emplace_iterator ei) } //namespace container { } //namespace boost { -#include - -#endif //#ifndef BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP +#endif //#ifndef BOOST_CONTAINER_DETAIL_CONSTRUCT_IN_PLACE_HPP diff --git a/include/boost/container/detail/flat_tree.hpp b/include/boost/container/detail/flat_tree.hpp index a2213d2..e0ab7c2 100644 --- a/include/boost/container/detail/flat_tree.hpp +++ b/include/boost/container/detail/flat_tree.hpp @@ -20,10 +20,6 @@ #include -#include -#include -#include - #include #include @@ -32,6 +28,8 @@ #include #include #include +#include //algo_equal(), algo_lexicographical_compare +#include #include #ifdef BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER #include @@ -39,10 +37,10 @@ #include #include +#include //std::pair + namespace boost { - namespace container { - namespace container_detail { template @@ -78,22 +76,20 @@ template struct get_flat_tree_iterators { #ifdef BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER - typedef Pointer iterator; + typedef Pointer iterator; typedef typename boost::intrusive:: - pointer_traits::element_type iterator_element_type; + pointer_traits::element_type iterator_element_type; typedef typename boost::intrusive:: pointer_traits:: template - rebind_pointer::type const_iterator; + rebind_pointer::type const_iterator; #else //BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER typedef typename boost::container::container_detail:: - vec_iterator iterator; + vec_iterator iterator; typedef typename boost::container::container_detail:: - vec_iterator const_iterator; + vec_iterator const_iterator; #endif //BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER - typedef boost::container::container_detail:: - reverse_iterator reverse_iterator; - typedef boost::container::container_detail:: - reverse_iterator const_reverse_iterator; + typedef boost::container::reverse_iterator reverse_iterator; + typedef boost::container::reverse_iterator const_reverse_iterator; }; template (std::distance(first, last)); + const size_type len = static_cast(boost::container::iterator_distance(first, last)); this->reserve(this->size()+len); this->priv_insert_equal_loop(first, last); } @@ -455,7 +451,7 @@ class flat_tree #endif ) { - const size_type len = static_cast(std::distance(first, last)); + const size_type len = static_cast(boost::container::iterator_distance(first, last)); this->reserve(this->size()+len); this->priv_insert_equal_loop_ordered(first, last); } @@ -706,13 +702,12 @@ class flat_tree friend bool operator==(const flat_tree& x, const flat_tree& y) { - return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin()); + return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } friend bool operator<(const flat_tree& x, const flat_tree& y) { - return std::lexicographical_compare(x.begin(), x.end(), - y.begin(), y.end()); + return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } friend bool operator!=(const flat_tree& x, const flat_tree& y) @@ -948,7 +943,7 @@ class flat_tree template void priv_insert_ordered_range(const bool unique_values, BidirIt first, BidirIt last) { - size_type len = static_cast(std::distance(first, last)); + size_type len = static_cast(boost::container::iterator_distance(first, last)); //Prereserve all memory so that iterators are not invalidated this->reserve(this->size()+len); //Auxiliary data for insertion positions. @@ -967,10 +962,10 @@ class flat_tree size_type unique_burst = 0u; size_type checked = 0; for(; checked != burst; ++checked){ - //Get the insertion position for each key, use std::iterator_traits::value_type + //Get the insertion position for each key, use iterator_traits::value_type //because it can be different from container::value_type //(e.g. conversion between std::pair -> boost::container::pair - const typename std::iterator_traits::value_type & val = *first; + const typename boost::container::iterator_traits::value_type & val = *first; pos = const_cast(*this).priv_lower_bound(pos, ce, KeyOfValue()(val)); //Check if already present if (pos != ce){ @@ -1006,7 +1001,7 @@ class flat_tree BOOST_ASSERT(first == last); } else{ - BOOST_ASSERT(size_type(std::distance(first, last)) == len); + BOOST_ASSERT(size_type(boost::container::iterator_distance(first, last)) == len); if(len) this->m_data.m_vect.insert(this->m_data.m_vect.cend(), len, first, last); } diff --git a/include/boost/container/detail/iterator.hpp b/include/boost/container/detail/iterator.hpp new file mode 100644 index 0000000..c1ef787 --- /dev/null +++ b/include/boost/container/detail/iterator.hpp @@ -0,0 +1,33 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2014-2014. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DETAIL_ITERATOR_HPP +#define BOOST_CONTAINER_DETAIL_ITERATOR_HPP + +#if defined(_MSC_VER) +# pragma once +#endif + +#include + +namespace boost { +namespace container { + +using ::boost::intrusive::iterator_traits; +using ::boost::intrusive::iterator_distance; +using ::boost::intrusive::iterator_advance; +using ::boost::intrusive::iterator; + +} //namespace container { +} //namespace boost { + +#endif //#ifndef BOOST_CONTAINER_DETAIL_ITERATORS_HPP diff --git a/include/boost/container/detail/iterators.hpp b/include/boost/container/detail/iterators.hpp index 0dabd3c..732d1f1 100644 --- a/include/boost/container/detail/iterators.hpp +++ b/include/boost/container/detail/iterators.hpp @@ -32,14 +32,14 @@ #include #endif -#include +#include namespace boost { namespace container { template class constant_iterator - : public std::iterator + : public ::boost::container::iterator { typedef constant_iterator this_type; @@ -150,7 +150,7 @@ class constant_iterator template class value_init_construct_iterator - : public std::iterator + : public ::boost::container::iterator { typedef value_init_construct_iterator this_type; @@ -261,7 +261,7 @@ class value_init_construct_iterator template class default_init_construct_iterator - : public std::iterator + : public ::boost::container::iterator { typedef default_init_construct_iterator this_type; @@ -373,7 +373,7 @@ class default_init_construct_iterator template class repeat_iterator - : public std::iterator + : public ::boost::container::iterator { typedef repeat_iterator this_type; @@ -483,7 +483,7 @@ class repeat_iterator template class emplace_iterator - : public std::iterator + : public ::boost::container::iterator { typedef emplace_iterator this_type; @@ -709,8 +709,8 @@ struct iiterator_types { typedef typename IIterator::value_type it_value_type; typedef typename iiterator_node_value_type::type value_type; - typedef typename std::iterator_traits::pointer it_pointer; - typedef typename std::iterator_traits::difference_type difference_type; + typedef typename boost::container::iterator_traits::pointer it_pointer; + typedef typename boost::container::iterator_traits::difference_type difference_type; typedef typename ::boost::intrusive::pointer_traits:: template rebind_pointer::type pointer; typedef typename ::boost::intrusive::pointer_traits:: @@ -723,9 +723,9 @@ struct iiterator_types }; template -struct std_iterator +struct iterator_types { - typedef typename std::iterator + typedef typename ::boost::container::iterator < typename iiterator_types::iterator_category , typename iiterator_types::value_type , typename iiterator_types::difference_type @@ -734,9 +734,9 @@ struct std_iterator }; template -struct std_iterator +struct iterator_types { - typedef typename std::iterator + typedef typename ::boost::container::iterator < typename iiterator_types::iterator_category , typename iiterator_types::value_type , typename iiterator_types::difference_type @@ -745,9 +745,9 @@ struct std_iterator }; template -class iterator +class iterator_from_iiterator { - typedef typename std_iterator::type types_t; + typedef typename iterator_types::type types_t; public: typedef typename types_t::pointer pointer; @@ -756,45 +756,45 @@ class iterator typedef typename types_t::iterator_category iterator_category; typedef typename types_t::value_type value_type; - iterator() + iterator_from_iiterator() {} - explicit iterator(IIterator iit) BOOST_CONTAINER_NOEXCEPT + explicit iterator_from_iiterator(IIterator iit) BOOST_CONTAINER_NOEXCEPT : m_iit(iit) {} - iterator(iterator const& other) BOOST_CONTAINER_NOEXCEPT + iterator_from_iiterator(iterator_from_iiterator const& other) BOOST_CONTAINER_NOEXCEPT : m_iit(other.get()) {} - iterator& operator++() BOOST_CONTAINER_NOEXCEPT + iterator_from_iiterator& operator++() BOOST_CONTAINER_NOEXCEPT { ++this->m_iit; return *this; } - iterator operator++(int) BOOST_CONTAINER_NOEXCEPT + iterator_from_iiterator operator++(int) BOOST_CONTAINER_NOEXCEPT { - iterator result (*this); + iterator_from_iiterator result (*this); ++this->m_iit; return result; } - iterator& operator--() BOOST_CONTAINER_NOEXCEPT + iterator_from_iiterator& operator--() BOOST_CONTAINER_NOEXCEPT { - //If the iterator is not a bidirectional iterator, operator-- should not exist - BOOST_STATIC_ASSERT((is_bidirectional_iterator::value)); + //If the iterator_from_iiterator is not a bidirectional iterator, operator-- should not exist + BOOST_STATIC_ASSERT((is_bidirectional_iterator::value)); --this->m_iit; return *this; } - iterator operator--(int) BOOST_CONTAINER_NOEXCEPT + iterator_from_iiterator operator--(int) BOOST_CONTAINER_NOEXCEPT { - iterator result (*this); + iterator_from_iiterator result (*this); --this->m_iit; return result; } - friend bool operator== (const iterator& l, const iterator& r) BOOST_CONTAINER_NOEXCEPT + friend bool operator== (const iterator_from_iiterator& l, const iterator_from_iiterator& r) BOOST_CONTAINER_NOEXCEPT { return l.m_iit == r.m_iit; } - friend bool operator!= (const iterator& l, const iterator& r) BOOST_CONTAINER_NOEXCEPT + friend bool operator!= (const iterator_from_iiterator& l, const iterator_from_iiterator& r) BOOST_CONTAINER_NOEXCEPT { return !(l == r); } reference operator*() const BOOST_CONTAINER_NOEXCEPT @@ -810,9 +810,10 @@ class iterator IIterator m_iit; }; -using ::boost::intrusive::detail::reverse_iterator; - } //namespace container_detail { + +using ::boost::intrusive::reverse_iterator; + } //namespace container { } //namespace boost { diff --git a/include/boost/container/detail/node_alloc_holder.hpp b/include/boost/container/detail/node_alloc_holder.hpp index c38f7d4..c4c6c50 100644 --- a/include/boost/container/detail/node_alloc_holder.hpp +++ b/include/boost/container/detail/node_alloc_holder.hpp @@ -39,7 +39,7 @@ #include #endif -#include +#include diff --git a/include/boost/container/detail/node_pool.hpp b/include/boost/container/detail/node_pool.hpp index 60d8266..1923934 100644 --- a/include/boost/container/detail/node_pool.hpp +++ b/include/boost/container/detail/node_pool.hpp @@ -25,8 +25,6 @@ #include #include #include -#include //std::unary_function -#include //std::swap #include namespace boost { diff --git a/include/boost/container/detail/pair.hpp b/include/boost/container/detail/pair.hpp index b7ad84c..457174a 100644 --- a/include/boost/container/detail/pair.hpp +++ b/include/boost/container/detail/pair.hpp @@ -26,7 +26,7 @@ #include #include //std::pair -#include //std::swap +#include //swap #include @@ -272,9 +272,8 @@ struct pair //swap void swap(pair& p) { - using std::swap; - swap(this->first, p.first); - swap(this->second, p.second); + ::boost::container::adl_swap(this->first, p.first); + ::boost::container::adl_swap(this->second, p.second); } }; diff --git a/include/boost/container/detail/swap.hpp b/include/boost/container/detail/swap.hpp new file mode 100644 index 0000000..f3c902d --- /dev/null +++ b/include/boost/container/detail/swap.hpp @@ -0,0 +1,77 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright 2007, 2008 Steven Watanabe, Joseph Gauterin, Niels Dekker +// (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DETAIL_SWAP_HPP +#define BOOST_CONTAINER_DETAIL_SWAP_HPP + +#if defined(_MSC_VER) +# pragma once +#endif + +//Based on Boost.Core's swap, but defaulting to a move-enabled swap. +// +// Note: the implementation of this utility contains various workarounds: +// - swap_impl is put outside the boost namespace, to avoid infinite +// recursion (causing stack overflow) when swapping objects of a primitive +// type. +// - swap_impl has a using-directive, rather than a using-declaration, +// because some compilers (including MSVC 7.1, Borland 5.9.3, and +// Intel 8.1) don't do argument-dependent lookup when it has a +// using-declaration instead. +// - boost::swap has two template arguments, instead of one, to +// avoid ambiguity when swapping objects of a Boost type that does +// not have its own boost::swap overload. + +#include //for std::size_t +#include //for boost::move + +namespace boost_container_swap_move { + template + void swap(T& left, T& right) + { + T tmp(::boost::move(left)); + left = ::boost::move(right); + right = ::boost::move(tmp); + } +} //namespace boost_container_swap_move { + +namespace boost_container_swap +{ + template + void adl_swap_impl(T& left, T& right) + { + //use boost_container_swap_move::swap if argument dependent lookup fails + using namespace boost_container_swap_move; + swap(left,right); + } + + template + void adl_swap_impl(T (& left)[N], T (& right)[N]) + { + for (std::size_t i = 0; i < N; ++i){ + ::boost_container_swap::adl_swap_impl(left[i], right[i]); + } + } +} //namespace boost_container_swap { + +namespace boost{ +namespace container{ + +template +void adl_swap(T1& left, T2& right) +{ + ::boost_container_swap::adl_swap_impl(left, right); +} + +} //namespace container{ +} //namespace boost{ + +#endif //#ifndef BOOST_CONTAINER_DETAIL_SWAP_HPP diff --git a/include/boost/container/detail/transform_iterator.hpp b/include/boost/container/detail/transform_iterator.hpp index c4e746c..de6f1ef 100644 --- a/include/boost/container/detail/transform_iterator.hpp +++ b/include/boost/container/detail/transform_iterator.hpp @@ -20,9 +20,7 @@ #include #include - #include -#include namespace boost { namespace container { @@ -58,7 +56,7 @@ struct operator_arrow_proxy template class transform_iterator : public UnaryFunction - , public std::iterator + , public boost::container::iterator < typename Iterator::iterator_category , typename container_detail::remove_reference::type , typename Iterator::difference_type @@ -156,10 +154,10 @@ class transform_iterator { return UnaryFunction::operator()(*m_it); } void advance(typename Iterator::difference_type n) - { std::advance(m_it, n); } + { boost::container::iterator_advance(m_it, n); } typename Iterator::difference_type distance_to(const transform_iterator &other)const - { return std::distance(other.m_it, m_it); } + { return boost::container::iterator_distance(other.m_it, m_it); } }; template diff --git a/include/boost/container/detail/tree.hpp b/include/boost/container/detail/tree.hpp index 3148296..274ae46 100644 --- a/include/boost/container/detail/tree.hpp +++ b/include/boost/container/detail/tree.hpp @@ -25,9 +25,11 @@ #include #include #include +#include //algo_equal(), algo_lexicographical_compare #include #include #include +#include // #include #include @@ -44,8 +46,6 @@ #endif #include //std::pair -#include -#include namespace boost { namespace container { @@ -523,10 +523,10 @@ class tree typedef key_node_compare KeyNodeCompare; public: - typedef container_detail::iterator iterator; - typedef container_detail::iterator const_iterator; - typedef container_detail::reverse_iterator reverse_iterator; - typedef container_detail::reverse_iterator const_reverse_iterator; + typedef container_detail::iterator_from_iiterator iterator; + typedef container_detail::iterator_from_iiterator const_iterator; + typedef boost::container::reverse_iterator reverse_iterator; + typedef boost::container::reverse_iterator const_reverse_iterator; tree() : AllocHolder() @@ -592,7 +592,7 @@ class tree else{ //Optimized allocation and construction this->allocate_many_and_construct - ( first, std::distance(first, last) + ( first, boost::container::iterator_distance(first, last) , insert_equal_end_hint_functor(this->icont())); } } @@ -628,7 +628,7 @@ class tree { //Optimized allocation and construction this->allocate_many_and_construct - ( first, std::distance(first, last) + ( first, boost::container::iterator_distance(first, last) , container_detail::push_back_functor(this->icont())); } @@ -1145,10 +1145,10 @@ class tree { intrusive_tree_proxy_t::rebalance(this->icont()); } friend bool operator==(const tree& x, const tree& y) - { return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin()); } + { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } friend bool operator<(const tree& x, const tree& y) - { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } friend bool operator!=(const tree& x, const tree& y) { return !(x == y); } diff --git a/include/boost/container/detail/utilities.hpp b/include/boost/container/detail/utilities.hpp index 25f035d..d2fe5c4 100644 --- a/include/boost/container/detail/utilities.hpp +++ b/include/boost/container/detail/utilities.hpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -42,8 +43,7 @@ #include #include #include -#include -#include //std::distance + namespace boost { namespace container { @@ -98,6 +98,7 @@ typename container_detail::enable_if_c swap(left, right); // may throw } */ + namespace container_detail { template @@ -174,14 +175,14 @@ inline T* iterator_to_pointer(T* i) { return i; } template -inline typename std::iterator_traits::pointer +inline typename boost::container::iterator_traits::pointer iterator_to_pointer(const Iterator &i) { return i.operator->(); } template inline typename boost::intrusive::pointer_traits - ::pointer>::element_type* + ::pointer>::element_type* iterator_to_raw_pointer(const Iterator &i) { return (to_raw_pointer)((iterator_to_pointer)(i)); } @@ -304,8 +305,8 @@ template struct are_contiguous_and_same { static const bool is_same_io = - is_same< typename remove_const< typename ::std::iterator_traits::value_type >::type - , typename ::std::iterator_traits::value_type + is_same< typename remove_const< typename ::boost::container::iterator_traits::value_type >::type + , typename ::boost::container::iterator_traits::value_type >::value; static const bool value = is_same_io && are_elements_contiguous::value && @@ -316,14 +317,14 @@ template struct is_memtransfer_copy_assignable { static const bool value = are_contiguous_and_same::value && - boost::has_trivial_assign< typename ::std::iterator_traits::value_type >::value; + boost::has_trivial_assign< typename ::boost::container::iterator_traits::value_type >::value; }; template struct is_memtransfer_copy_constructible { static const bool value = are_contiguous_and_same::value && - boost::has_trivial_copy< typename ::std::iterator_traits::value_type >::value; + boost::has_trivial_copy< typename ::boost::container::iterator_traits::value_type >::value; }; template @@ -351,51 +352,51 @@ template typename F> // F models ForwardIterator inline F memmove(I f, I l, F r) BOOST_CONTAINER_NOEXCEPT { - typedef typename std::iterator_traits::value_type value_type; - typename std::iterator_traits::difference_type n = std::distance(f, l); + typedef typename boost::container::iterator_traits::value_type value_type; + typename boost::container::iterator_traits::difference_type n = boost::container::iterator_distance(f, l); ::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n); - std::advance(r, n); + boost::container::iterator_advance(r, n); return r; } template // F models ForwardIterator -F memmove_n(I f, typename std::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT +F memmove_n(I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT { - typedef typename std::iterator_traits::value_type value_type; + typedef typename boost::container::iterator_traits::value_type value_type; ::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n); - std::advance(r, n); + boost::container::iterator_advance(r, n); return r; } template // F models ForwardIterator -I memmove_n_source(I f, typename std::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT +I memmove_n_source(I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT { - typedef typename std::iterator_traits::value_type value_type; + typedef typename boost::container::iterator_traits::value_type value_type; ::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n); - std::advance(f, n); + boost::container::iterator_advance(f, n); return f; } template // F models ForwardIterator -I memmove_n_source_dest(I f, typename std::iterator_traits::difference_type n, F &r) BOOST_CONTAINER_NOEXCEPT +I memmove_n_source_dest(I f, typename boost::container::iterator_traits::difference_type n, F &r) BOOST_CONTAINER_NOEXCEPT { - typedef typename std::iterator_traits::value_type value_type; + typedef typename boost::container::iterator_traits::value_type value_type; ::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n); - std::advance(f, n); - std::advance(r, n); + boost::container::iterator_advance(f, n); + boost::container::iterator_advance(r, n); return f; } template struct is_memzero_initializable { - typedef typename ::std::iterator_traits::value_type value_type; + typedef typename ::boost::container::iterator_traits::value_type value_type; static const bool value = are_elements_contiguous::value && ( ::boost::is_integral::value || ::boost::is_enum::value #if defined(BOOST_CONTAINER_MEMZEROED_POINTER_IS_NULL) @@ -487,7 +488,7 @@ template typename I, // I models InputIterator typename F> // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_constructible::type - uninitialized_move_alloc_n(A &a, I f, typename std::iterator_traits::difference_type n, F r) + uninitialized_move_alloc_n(A &a, I f, typename boost::container::iterator_traits::difference_type n, F r) { F back = r; BOOST_TRY{ @@ -511,7 +512,7 @@ template typename I, // I models InputIterator typename F> // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_constructible::type - uninitialized_move_alloc_n(A &, I f, typename std::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT + uninitialized_move_alloc_n(A &, I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT { return container_detail::memmove_n(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -532,7 +533,7 @@ template typename I, // I models InputIterator typename F> // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_constructible::type - uninitialized_move_alloc_n_source(A &a, I f, typename std::iterator_traits::difference_type n, F r) + uninitialized_move_alloc_n_source(A &a, I f, typename boost::container::iterator_traits::difference_type n, F r) { F back = r; BOOST_TRY{ @@ -556,7 +557,7 @@ template typename I, // I models InputIterator typename F> // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_constructible::type - uninitialized_move_alloc_n_source(A &, I f, typename std::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT + uninitialized_move_alloc_n_source(A &, I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT { return container_detail::memmove_n_source(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -622,7 +623,7 @@ template typename I, // I models InputIterator typename F> // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_constructible::type - uninitialized_copy_alloc_n(A &a, I f, typename std::iterator_traits::difference_type n, F r) + uninitialized_copy_alloc_n(A &a, I f, typename boost::container::iterator_traits::difference_type n, F r) { F back = r; BOOST_TRY{ @@ -646,7 +647,7 @@ template typename I, // I models InputIterator typename F> // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_constructible::type - uninitialized_copy_alloc_n(A &, I f, typename std::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT + uninitialized_copy_alloc_n(A &, I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT { return container_detail::memmove_n(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -667,7 +668,7 @@ template typename I, // I models InputIterator typename F> // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_constructible::type - uninitialized_copy_alloc_n_source(A &a, I f, typename std::iterator_traits::difference_type n, F r) + uninitialized_copy_alloc_n_source(A &a, I f, typename boost::container::iterator_traits::difference_type n, F r) { F back = r; BOOST_TRY{ @@ -691,7 +692,7 @@ template typename I, // I models InputIterator typename F> // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_constructible::type - uninitialized_copy_alloc_n_source(A &, I f, typename std::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT + uninitialized_copy_alloc_n_source(A &, I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT { return container_detail::memmove_n_source(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -736,9 +737,9 @@ template inline typename container_detail::enable_if_memzero_initializable::type uninitialized_value_init_alloc_n(A &, typename allocator_traits::difference_type n, F r) { - typedef typename std::iterator_traits::value_type value_type; + typedef typename boost::container::iterator_traits::value_type value_type; ::memset((void*)container_detail::iterator_to_raw_pointer(r), 0, sizeof(value_type)*n); - std::advance(r, n); + boost::container::iterator_advance(r, n); return r; } @@ -885,7 +886,7 @@ template // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_assignable::type - copy_n(I f, typename std::iterator_traits::difference_type n, F r) + copy_n(I f, typename boost::container::iterator_traits::difference_type n, F r) { while (n--) { *r = *f; @@ -898,7 +899,7 @@ template // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_assignable::type - copy_n(I f, typename std::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT + copy_n(I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT { return container_detail::memmove_n(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -911,7 +912,7 @@ template // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_assignable::type - copy_n_source(I f, typename std::iterator_traits::difference_type n, F r) + copy_n_source(I f, typename boost::container::iterator_traits::difference_type n, F r) { while (n--) { *r = *f; @@ -924,7 +925,7 @@ template // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_assignable::type - copy_n_source(I f, typename std::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT + copy_n_source(I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT { return container_detail::memmove_n_source(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -937,7 +938,7 @@ template // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_assignable::type - copy_n_source_dest(I f, typename std::iterator_traits::difference_type n, F &r) + copy_n_source_dest(I f, typename boost::container::iterator_traits::difference_type n, F &r) { while (n--) { *r = *f; @@ -950,7 +951,7 @@ template // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_assignable::type - copy_n_source_dest(I f, typename std::iterator_traits::difference_type n, F &r) BOOST_CONTAINER_NOEXCEPT + copy_n_source_dest(I f, typename boost::container::iterator_traits::difference_type n, F &r) BOOST_CONTAINER_NOEXCEPT { return container_detail::memmove_n_source_dest(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -989,7 +990,7 @@ template // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_assignable::type - move_n(I f, typename std::iterator_traits::difference_type n, F r) + move_n(I f, typename boost::container::iterator_traits::difference_type n, F r) { while (n--) { *r = ::boost::move(*f); @@ -1002,7 +1003,7 @@ template // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_assignable::type - move_n(I f, typename std::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT + move_n(I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT { return container_detail::memmove_n(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -1015,7 +1016,7 @@ template // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_assignable::type - move_n_source(I f, typename std::iterator_traits::difference_type n, F r) + move_n_source(I f, typename boost::container::iterator_traits::difference_type n, F r) { while (n--) { *r = ::boost::move(*f); @@ -1028,7 +1029,7 @@ template // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_assignable::type - move_n_source(I f, typename std::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT + move_n_source(I f, typename boost::container::iterator_traits::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT { return container_detail::memmove_n_source(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -1041,7 +1042,7 @@ template // F models ForwardIterator inline typename container_detail::disable_if_memtransfer_copy_assignable::type - move_n_source_dest(I f, typename std::iterator_traits::difference_type n, F &r) + move_n_source_dest(I f, typename boost::container::iterator_traits::difference_type n, F &r) { while (n--) { *r = ::boost::move(*f); @@ -1054,7 +1055,7 @@ template // F models ForwardIterator inline typename container_detail::enable_if_memtransfer_copy_assignable::type - move_n_source_dest(I f, typename std::iterator_traits::difference_type n, F &r) BOOST_CONTAINER_NOEXCEPT + move_n_source_dest(I f, typename boost::container::iterator_traits::difference_type n, F &r) BOOST_CONTAINER_NOEXCEPT { return container_detail::memmove_n_source_dest(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -1066,9 +1067,9 @@ inline typename container_detail::enable_if_memtransfer_copy_assignable template // I models InputIterator -inline void destroy_alloc_n(A &a, I f, typename std::iterator_traits::difference_type n +inline void destroy_alloc_n(A &a, I f, typename boost::container::iterator_traits::difference_type n ,typename boost::container::container_detail::enable_if_c - < !boost::has_trivial_destructor::value_type>::value >::type* = 0) + < !boost::has_trivial_destructor::value_type>::value >::type* = 0) { while(n--){ allocator_traits::destroy(a, container_detail::iterator_to_raw_pointer(f++)); @@ -1078,9 +1079,9 @@ inline void destroy_alloc_n(A &a, I f, typename std::iterator_traits::differe template // I models InputIterator -inline void destroy_alloc_n(A &, I, typename std::iterator_traits::difference_type +inline void destroy_alloc_n(A &, I, typename boost::container::iterator_traits::difference_type ,typename boost::container::container_detail::enable_if_c - < boost::has_trivial_destructor::value_type>::value >::type* = 0) + < boost::has_trivial_destructor::value_type>::value >::type* = 0) {} ////////////////////////////////////////////////////////////////////////////// @@ -1133,8 +1134,8 @@ inline typename container_detail::enable_if_c ::memcpy(stora_ptr, large_ptr, n_i_bytes); ::memcpy(large_ptr, short_ptr, n_i_bytes); ::memcpy(short_ptr, stora_ptr, n_i_bytes); - std::advance(large_range_f, n_i); - std::advance(short_range_f, n_i); + boost::container::iterator_advance(large_range_f, n_i); + boost::container::iterator_advance(short_range_f, n_i); boost::container::uninitialized_move_alloc_n(a, large_range_f, n_j - n_i, short_range_f); // may throw boost::container::destroy_alloc_n(a, large_range_f, n_j - n_i); } @@ -1204,8 +1205,8 @@ inline typename container_detail::enable_if_c ::memcpy(stora_ptr, large_ptr, szt_rem); ::memcpy(large_ptr, short_ptr, szt_rem); ::memcpy(short_ptr, stora_ptr, szt_rem); - std::advance(large_range_f, n_i); - std::advance(short_range_f, n_i); + boost::container::iterator_advance(large_range_f, n_i); + boost::container::iterator_advance(short_range_f, n_i); boost::container::uninitialized_move_alloc_n(a, large_range_f, n_j - n_i, short_range_f); // may throw boost::container::destroy_alloc_n(a, large_range_f, n_j - n_i); } diff --git a/include/boost/container/flat_map.hpp b/include/boost/container/flat_map.hpp index f8b6ed4..a08e8a3 100644 --- a/include/boost/container/flat_map.hpp +++ b/include/boost/container/flat_map.hpp @@ -19,12 +19,11 @@ #include #include -#include -#include -#include + #include #include #include +#include //equal() #include #include #include @@ -32,6 +31,9 @@ #include #include +#include //pair +#include //less +#include //allocator #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include #endif @@ -967,7 +969,7 @@ class flat_map //! //! Complexity: Linear to the number of elements in the container. friend bool operator==(const flat_map& x, const flat_map& y) - { return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin()); } + { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } //! Effects: Returns true if x and y are unequal //! @@ -979,7 +981,7 @@ class flat_map //! //! Complexity: Linear to the number of elements in the container. friend bool operator<(const flat_map& x, const flat_map& y) - { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } //! Effects: Returns true if x is greater than y //! @@ -1868,7 +1870,7 @@ class flat_multimap //! //! Complexity: Linear to the number of elements in the container. friend bool operator==(const flat_multimap& x, const flat_multimap& y) - { return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin()); } + { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } //! Effects: Returns true if x and y are unequal //! @@ -1880,7 +1882,7 @@ class flat_multimap //! //! Complexity: Linear to the number of elements in the container. friend bool operator<(const flat_multimap& x, const flat_multimap& y) - { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } //! Effects: Returns true if x is greater than y //! diff --git a/include/boost/container/flat_set.hpp b/include/boost/container/flat_set.hpp index 631c99e..ab8f56a 100644 --- a/include/boost/container/flat_set.hpp +++ b/include/boost/container/flat_set.hpp @@ -19,9 +19,6 @@ #include #include -#include -#include -#include #include #include #include @@ -29,9 +26,13 @@ #include #include +#include //pair +#include //less +#include //allocator #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include #endif + namespace boost { namespace container { diff --git a/include/boost/container/list.hpp b/include/boost/container/list.hpp index c3eb51e..c6de685 100644 --- a/include/boost/container/list.hpp +++ b/include/boost/container/list.hpp @@ -20,7 +20,10 @@ #include #include #include +#include #include +#include + #include #include #include @@ -38,16 +41,11 @@ #include #endif +#include //std::allocator #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include #endif -#include -#include -#include -#include -#include - namespace boost { namespace container { @@ -149,8 +147,8 @@ class list BOOST_COPYABLE_AND_MOVABLE(list) - typedef container_detail::iterator iterator_impl; - typedef container_detail::iterator const_iterator_impl; + typedef container_detail::iterator_from_iiterator iterator_impl; + typedef container_detail::iterator_from_iiterator const_iterator_impl; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED public: @@ -171,8 +169,8 @@ class list typedef BOOST_CONTAINER_IMPDEF(NodeAlloc) stored_allocator_type; typedef BOOST_CONTAINER_IMPDEF(iterator_impl) iterator; typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl) const_iterator; - typedef BOOST_CONTAINER_IMPDEF(container_detail::reverse_iterator) reverse_iterator; - typedef BOOST_CONTAINER_IMPDEF(container_detail::reverse_iterator) const_reverse_iterator; + typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator) reverse_iterator; + typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator) const_reverse_iterator; ////////////////////////////////////////////// // @@ -838,7 +836,7 @@ class list //! Throws: If memory allocation throws, T's constructor from a //! dereferenced InpIt throws. //! - //! Complexity: Linear to std::distance [first, last). + //! Complexity: Linear to distance [first, last). template iterator insert(const_iterator p, InpIt first, InpIt last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) @@ -878,7 +876,7 @@ class list insertion_functor func(this->icont(), p.get()); iterator before_p(p.get()); --before_p; - this->allocate_many_and_construct(first, std::distance(first, last), func); + this->allocate_many_and_construct(first, boost::container::iterator_distance(first, last), func); return ++before_p; } #endif @@ -893,7 +891,7 @@ class list //! Throws: If memory allocation throws, T's constructor from a //! dereferenced std::initializer_list iterator throws. //! - //! Complexity: Linear to std::distance [il.begin(), il.end()). + //! Complexity: Linear to distance [il.begin(), il.end()). iterator insert(const_iterator p, std::initializer_list il) { return insert(p, il.begin(), il.end()); } #endif @@ -1065,7 +1063,7 @@ class list //! Requires: p must point to an element contained //! by this list. first and last must point to elements contained in list x. - //! n == std::distance(first, last). this' allocator and x's allocator shall compare equal + //! n == distance(first, last). this' allocator and x's allocator shall compare equal //! //! Effects: Transfers the range pointed by first and last from list x to this list, //! before the the element pointed by p. No destructors or copy constructors are called. @@ -1086,7 +1084,7 @@ class list //! Requires: p must point to an element contained //! by this list. first and last must point to elements contained in list x. - //! n == std::distance(first, last). this' allocator and x's allocator shall compare equal + //! n == distance(first, last). this' allocator and x's allocator shall compare equal //! //! Effects: Transfers the range pointed by first and last from list x to this list, //! before the the element pointed by p. No destructors or copy constructors are called. @@ -1270,21 +1268,7 @@ class list //! //! Complexity: Linear to the number of elements in the container. friend bool operator==(const list& x, const list& y) - { - if(x.size() != y.size()){ - return false; - } - typedef typename list::const_iterator const_iterator; - const_iterator end1 = x.end(); - - const_iterator i1 = x.begin(); - const_iterator i2 = y.begin(); - while (i1 != end1 && *i1 == *i2) { - ++i1; - ++i2; - } - return i1 == end1; - } + { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } //! Effects: Returns true if x and y are unequal //! @@ -1296,7 +1280,7 @@ class list //! //! Complexity: Linear to the number of elements in the container. friend bool operator<(const list& x, const list& y) - { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + { return boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } //! Effects: Returns true if x is greater than y //! diff --git a/include/boost/container/map.hpp b/include/boost/container/map.hpp index 6bbb1bc..e0c3835 100644 --- a/include/boost/container/map.hpp +++ b/include/boost/container/map.hpp @@ -19,9 +19,6 @@ #include #include -#include -#include -#include #include #include #include @@ -37,6 +34,9 @@ #include #include +#include //pair +#include //less +#include //allocator #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include #endif diff --git a/include/boost/container/node_allocator.hpp b/include/boost/container/node_allocator.hpp index 8004339..691334e 100644 --- a/include/boost/container/node_allocator.hpp +++ b/include/boost/container/node_allocator.hpp @@ -28,8 +28,7 @@ #include #include #include -#include -#include +#include #include namespace boost { diff --git a/include/boost/container/set.hpp b/include/boost/container/set.hpp index ee19704..3579fef 100644 --- a/include/boost/container/set.hpp +++ b/include/boost/container/set.hpp @@ -19,10 +19,6 @@ #include #include -#include -#include -#include - #include #include #include @@ -32,6 +28,10 @@ #ifndef BOOST_CONTAINER_PERFECT_FORWARDING #include #endif + +#include //pair +#include //less +#include //allocator #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include #endif diff --git a/include/boost/container/slist.hpp b/include/boost/container/slist.hpp index fdc2325..a184971 100644 --- a/include/boost/container/slist.hpp +++ b/include/boost/container/slist.hpp @@ -20,19 +20,24 @@ #include #include -#include -#include -#include -#include #include #include #include #include -#include +#include + #include #include +#include //algo_equal(), algo_lexicographical_compare + + +#include #include -#include +#include +#include +#include +#include + #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) @@ -41,12 +46,7 @@ #include #endif -#include -#include -#include -#include -#include - +#include //std::allocator #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include #endif @@ -181,8 +181,8 @@ class slist typedef boost::container::equal_to_value equal_to_value_type; BOOST_COPYABLE_AND_MOVABLE(slist) - typedef container_detail::iterator iterator_impl; - typedef container_detail::iterator const_iterator_impl; + typedef container_detail::iterator_from_iiterator iterator_impl; + typedef container_detail::iterator_from_iiterator const_iterator_impl; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED public: @@ -875,7 +875,7 @@ class slist { //Optimized allocation and construction insertion_functor func(this->icont(), prev.get()); - this->allocate_many_and_construct(first, std::distance(first, last), func); + this->allocate_many_and_construct(first, boost::container::iterator_distance(first, last), func); return iterator(func.inserted_first()); } #endif @@ -1058,7 +1058,7 @@ class slist //! Requires: prev_p must be a valid iterator of this. //! before_first and before_last must be valid iterators of x. //! prev_p must not be contained in [before_first, before_last) range. - //! n == std::distance(before_first, before_last). + //! n == distance(before_first, before_last). //! this' allocator and x's allocator shall compare equal. //! //! Effects: Transfers the range [before_first + 1, before_last + 1) @@ -1082,7 +1082,7 @@ class slist //! Requires: prev_p must be a valid iterator of this. //! before_first and before_last must be valid iterators of x. //! prev_p must not be contained in [before_first, before_last) range. - //! n == std::distance(before_first, before_last). + //! n == distance(before_first, before_last). //! this' allocator and x's allocator shall compare equal. //! //! Effects: Transfers the range [before_first + 1, before_last + 1) @@ -1349,7 +1349,7 @@ class slist //! Throws: If memory allocation throws, T's constructor from a //! dereferenced InpIt throws. //! - //! Complexity: Linear to std::distance [first, last) plus + //! Complexity: Linear to distance [first, last) plus //! linear to the elements before p. template iterator insert(const_iterator p, InIter first, InIter last) @@ -1500,21 +1500,7 @@ class slist //! //! Complexity: Linear to the number of elements in the container. friend bool operator==(const slist& x, const slist& y) - { - if(x.size() != y.size()){ - return false; - } - typedef typename slist::const_iterator const_iterator; - const_iterator end1 = x.end(); - - const_iterator i1 = x.begin(); - const_iterator i2 = y.begin(); - while (i1 != end1 && *i1 == *i2){ - ++i1; - ++i2; - } - return i1 == end1; - } + { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } //! Effects: Returns true if x and y are unequal //! @@ -1526,7 +1512,7 @@ class slist //! //! Complexity: Linear to the number of elements in the container. friend bool operator<(const slist& x, const slist& y) - { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } //! Effects: Returns true if x is greater than y //! diff --git a/include/boost/container/stable_vector.hpp b/include/boost/container/stable_vector.hpp index 59648a4..12bbe24 100644 --- a/include/boost/container/stable_vector.hpp +++ b/include/boost/container/stable_vector.hpp @@ -31,8 +31,10 @@ #include #include #include -#include +#include +#include //algo_equal(), algo_lexicographical_compare #include +#include #include #include #include @@ -41,26 +43,22 @@ #include #include #include -#include +#include //std::pair #include +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) +#include +#endif #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -#include - -//#define STABLE_VECTOR_ENABLE_INVARIANT_CHECKING - + #include + //#define STABLE_VECTOR_ENABLE_INVARIANT_CHECKING #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED namespace boost { namespace container { -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) -#include -#endif - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED namespace stable_vector_detail{ @@ -506,8 +504,8 @@ class stable_vector typedef node_allocator_type stored_allocator_type; typedef BOOST_CONTAINER_IMPDEF(iterator_impl) iterator; typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl) const_iterator; - typedef BOOST_CONTAINER_IMPDEF(container_detail::reverse_iterator) reverse_iterator; - typedef BOOST_CONTAINER_IMPDEF(container_detail::reverse_iterator) const_reverse_iterator; + typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator) reverse_iterator; + typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator) const_reverse_iterator; #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: @@ -999,7 +997,7 @@ class stable_vector size_type size() const BOOST_CONTAINER_NOEXCEPT { const size_type index_size = this->index.size(); - return (index_size - ExtraPointers) & (std::size_t(0u) -std::size_t(index_size != 0)); + return (index_size - ExtraPointers) & (size_type(0u) -size_type(index_size != 0)); } //! Effects: Returns the largest possible size of the stable_vector. @@ -1462,7 +1460,7 @@ class stable_vector //! //! Returns: an iterator to the first inserted element or p if first == last. //! - //! Complexity: Linear to std::distance [il.begin(), il.end()). + //! Complexity: Linear to distance [il.begin(), il.end()). iterator insert(const_iterator p, std::initializer_list il) { STABLE_VECTOR_CHECK_INVARIANT; @@ -1479,7 +1477,7 @@ class stable_vector //! Throws: If memory allocation throws, T's constructor from a //! dereferenced InpIt throws or T's copy constructor throws. //! - //! Complexity: Linear to std::distance [first, last). + //! Complexity: Linear to distance [first, last). template iterator insert(const_iterator p, InputIterator first, InputIterator last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) @@ -1507,7 +1505,7 @@ class stable_vector >::type * = 0 ) { - const size_type num_new = static_cast(std::distance(first, last)); + const size_type num_new = static_cast(boost::container::iterator_distance(first, last)); const size_type idx = static_cast(p - this->cbegin()); if(num_new){ //Fills the node pool and inserts num_new null pointers in idx. @@ -1623,7 +1621,7 @@ class stable_vector //! //! Complexity: Linear to the number of elements in the container. friend bool operator==(const stable_vector& x, const stable_vector& y) - { return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin()); } + { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } //! Effects: Returns true if x and y are unequal //! @@ -1635,7 +1633,7 @@ class stable_vector //! //! Complexity: Linear to the number of elements in the container. friend bool operator<(const stable_vector& x, const stable_vector& y) - { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } + { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } //! Effects: Returns true if x is greater than y //! diff --git a/include/boost/container/static_vector.hpp b/include/boost/container/static_vector.hpp index d3f8772..628de2b 100644 --- a/include/boost/container/static_vector.hpp +++ b/include/boost/container/static_vector.hpp @@ -20,6 +20,11 @@ #include #include +#include +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) +#include +#endif + namespace boost { namespace container { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED diff --git a/include/boost/container/string.hpp b/include/boost/container/string.hpp index f1b6720..895278d 100644 --- a/include/boost/container/string.hpp +++ b/include/boost/container/string.hpp @@ -28,18 +28,18 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include -#include #include -#include #include #include #include @@ -410,7 +410,9 @@ class basic_string_base { if(this->is_short()){ if(other.is_short()){ - std::swap(this->members_.m_repr, other.members_.m_repr); + repr_t tmp(this->members_.m_repr); + this->members_.m_repr = other.members_.m_repr; + other.members_.m_repr = tmp; } else{ short_t short_backup(this->members_.m_repr.short_repr()); @@ -542,8 +544,8 @@ class basic_string typedef BOOST_CONTAINER_IMPDEF(allocator_type) stored_allocator_type; typedef BOOST_CONTAINER_IMPDEF(pointer) iterator; typedef BOOST_CONTAINER_IMPDEF(const_pointer) const_iterator; - typedef BOOST_CONTAINER_IMPDEF(container_detail::reverse_iterator) reverse_iterator; - typedef BOOST_CONTAINER_IMPDEF(container_detail::reverse_iterator) const_reverse_iterator; + typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator) reverse_iterator; + typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator) const_reverse_iterator; static const size_type npos = size_type(-1); #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -1457,7 +1459,7 @@ class basic_string { const size_type n_pos = p - this->cbegin(); if (first != last) { - const size_type n = std::distance(first, last); + const size_type n = boost::container::iterator_distance(first, last); const size_type old_size = this->priv_size(); const size_type remaining = this->capacity() - old_size; const pointer old_start = this->priv_addr(); @@ -1500,7 +1502,7 @@ class basic_string } else { ForwardIter mid = first; - std::advance(mid, elems_after + 1); + boost::container::iterator_advance(mid, elems_after + 1); priv_uninitialized_copy(mid, last, old_start + old_size + 1); const size_type newer_size = old_size + (n - elems_after); @@ -1849,7 +1851,7 @@ class basic_string >::type * = 0 ) { - difference_type n = std::distance(j1, j2); + difference_type n = boost::container::iterator_distance(j1, j2); const difference_type len = i2 - i1; if (len >= n) { this->priv_copy(j1, j2, const_cast(container_detail::to_raw_pointer(i1))); @@ -1857,7 +1859,7 @@ class basic_string } else { ForwardIter m = j1; - std::advance(m, len); + boost::container::iterator_advance(m, len); this->priv_copy(j1, m, const_cast(container_detail::to_raw_pointer(i1))); this->insert(i2, m, j2); } @@ -2503,7 +2505,7 @@ class basic_string InputIter f, InputIter l, container_detail::false_) { - typedef typename std::iterator_traits::iterator_category Category; + typedef typename boost::container::iterator_traits::iterator_category Category; return this->priv_replace(first, last, f, l, Category()); } diff --git a/include/boost/container/vector.hpp b/include/boost/container/vector.hpp index e5494f7..fb84662 100644 --- a/include/boost/container/vector.hpp +++ b/include/boost/container/vector.hpp @@ -19,14 +19,6 @@ #include #include -//#include //Already included by container_fwd.hpp -#include //for std::allocator -#include //for std::random_access_iterator_tag -#include //for std::pair,std::distance -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) -#include //for std::initializer_list -#endif - #include #include #include @@ -46,6 +38,8 @@ #include #include #include +#include //equal() +#include #include @@ -56,6 +50,12 @@ #include #include +#include //for std::allocator +#include //for std::pair +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) +#include //for std::initializer_list +#endif + namespace boost { namespace container { @@ -505,7 +505,7 @@ struct vector_alloc_holder void priv_swap_members_impl(vector_alloc_holder &x) { - const std::size_t MaxTmpStorage = sizeof(value_type)*Allocator::internal_capacity; + const size_type MaxTmpStorage = sizeof(value_type)*Allocator::internal_capacity; value_type *const first_this = container_detail::to_raw_pointer(this->start()); value_type *const first_x = container_detail::to_raw_pointer(x.start()); @@ -571,8 +571,8 @@ class vector typedef BOOST_CONTAINER_IMPDEF(iterator_impl) iterator; typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl) const_iterator; #endif - typedef BOOST_CONTAINER_IMPDEF(container_detail::reverse_iterator) reverse_iterator; - typedef BOOST_CONTAINER_IMPDEF(container_detail::reverse_iterator) const_reverse_iterator; + typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator) reverse_iterator; + typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator) const_reverse_iterator; #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: @@ -981,7 +981,7 @@ class vector { //For Fwd iterators the standard only requires EmplaceConstructible and assignable from *first //so we can't do any backwards allocation - const size_type input_sz = static_cast(std::distance(first, last)); + const size_type input_sz = static_cast(boost::container::iterator_distance(first, last)); const size_type old_capacity = this->capacity(); if(input_sz > old_capacity){ //If input range is too big, we need to reallocate size_type real_cap = 0; @@ -1608,7 +1608,7 @@ class vector //! Throws: If memory allocation throws, T's constructor from a //! dereferenced InpIt throws or T's copy/move constructor/assignment throws. //! - //! Complexity: Linear to std::distance [first, last). + //! Complexity: Linear to boost::container::iterator_distance [first, last). template iterator insert(const_iterator pos, InIt first, InIt last BOOST_CONTAINER_DOCIGN(BOOST_CONTAINER_I typename container_detail::enable_if_c @@ -1636,12 +1636,12 @@ class vector ) { container_detail::insert_range_proxy proxy(first); - return this->priv_forward_range_insert(vector_iterator_get_ptr(pos), std::distance(first, last), proxy, alloc_version()); + return this->priv_forward_range_insert(vector_iterator_get_ptr(pos), boost::container::iterator_distance(first, last), proxy, alloc_version()); } #endif //! Requires: p must be a valid iterator of *this. num, must - //! be equal to std::distance(first, last) + //! be equal to boost::container::iterator_distance(first, last) //! //! Effects: Insert a copy of the [first, last) range before pos. //! @@ -1650,9 +1650,9 @@ class vector //! Throws: If memory allocation throws, T's constructor from a //! dereferenced InpIt throws or T's copy/move constructor/assignment throws. //! - //! Complexity: Linear to std::distance [first, last). + //! Complexity: Linear to boost::container::iterator_distance [first, last). //! - //! Note: This function avoids a linear operation to calculate std::distance[first, last) + //! Note: This function avoids a linear operation to calculate boost::container::iterator_distance[first, last) //! for forward and bidirectional iterators, and a one by one insertion for input iterators. This is a //! a non-standard extension. #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) @@ -1660,7 +1660,7 @@ class vector iterator insert(const_iterator pos, size_type num, InIt first, InIt last) { BOOST_ASSERT(container_detail::is_input_iterator::value || - num == static_cast(std::distance(first, last))); + num == static_cast(boost::container::iterator_distance(first, last))); (void)last; container_detail::insert_range_proxy proxy(first); return this->priv_forward_range_insert(vector_iterator_get_ptr(pos), num, proxy, alloc_version()); @@ -1772,21 +1772,7 @@ class vector //! //! Complexity: Linear to the number of elements in the container. friend bool operator==(const vector& x, const vector& y) - { - if(x.size() != y.size()){ - return false; - } - else{ - const_iterator first1(x.cbegin()), first2(y.cbegin()); - const const_iterator last1(x.cend()); - for (; first1 != last1; ++first1, ++first2) { - if (*first1 != *first2) { - return false; - } - } - return true; - } - } + { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } //! Effects: Returns true if x and y are unequal //! @@ -2464,7 +2450,7 @@ class vector while(insertions_left){ if(do_skip){ size_type n = *(--last_skip_it); - std::advance(last_value_it, -difference_type(n)); + boost::container::iterator_advance(last_value_it, -difference_type(n)); } const size_type pos = static_cast(*(--last_position_it)); BOOST_ASSERT(pos <= old_size_pos); diff --git a/proj/vc7ide/container.vcproj b/proj/vc7ide/container.vcproj index 1d190a4..3b5361f 100644 --- a/proj/vc7ide/container.vcproj +++ b/proj/vc7ide/container.vcproj @@ -174,7 +174,7 @@ RelativePath="..\..\..\..\boost\container\detail\advanced_insert_int.hpp"> + RelativePath="..\..\..\..\boost\container\detail\algorithm.hpp"> @@ -200,6 +200,9 @@ + + @@ -216,7 +219,7 @@ RelativePath="..\..\..\..\boost\container\detail\hash_table.hpp"> + RelativePath="..\..\..\..\boost\container\detail\iterator.hpp"> @@ -257,15 +260,15 @@ - - + + diff --git a/test/check_equal_containers.hpp b/test/check_equal_containers.hpp index 1e09386..0f55537 100644 --- a/test/check_equal_containers.hpp +++ b/test/check_equal_containers.hpp @@ -14,11 +14,11 @@ #include #include #include -#include -#include -#include #include +#include +#include + namespace boost{ namespace container { namespace test{ @@ -68,7 +68,7 @@ bool CheckEqualContainers(const MyBoostCont &boostcont, const MyStdCont &stdcont typename MyBoostCont::const_iterator itboost(boostcont.begin()), itboostend(boostcont.end()); typename MyStdCont::const_iterator itstd(stdcont.begin()); - typename MyStdCont::size_type dist = (typename MyStdCont::size_type)std::distance(itboost, itboostend); + typename MyStdCont::size_type dist = (typename MyStdCont::size_type)boost::container::iterator_distance(itboost, itboostend); if(dist != boostcont.size()){ return false; } diff --git a/test/expand_bwd_test_template.hpp b/test/expand_bwd_test_template.hpp index bdb623e..ee73c28 100644 --- a/test/expand_bwd_test_template.hpp +++ b/test/expand_bwd_test_template.hpp @@ -14,8 +14,9 @@ #include #include #include +#include #include "expand_bwd_test_allocator.hpp" -#include +#include //equal() #include "movable_int.hpp" #include #include @@ -28,7 +29,7 @@ bool CheckEqualVector(const Vector1 &vector1, const Vector2 &vector2) { if(vector1.size() != vector2.size()) return false; - return std::equal(vector1.begin(), vector1.end(), vector2.begin()); + return boost::container::algo_equal(vector1.begin(), vector1.end(), vector2.begin()); } template diff --git a/test/flat_map_test.cpp b/test/flat_map_test.cpp index 1f189b2..1e11cd2 100644 --- a/test/flat_map_test.cpp +++ b/test/flat_map_test.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include "print_container.hpp" #include "dummy_test_allocator.hpp" @@ -21,8 +22,10 @@ #include "propagate_allocator_test.hpp" #include "container_common_tests.hpp" #include "emplace_test.hpp" + #include -#include +#include + using namespace boost::container; diff --git a/test/input_from_forward_iterator.hpp b/test/input_from_forward_iterator.hpp index ebc3973..9436cef 100644 --- a/test/input_from_forward_iterator.hpp +++ b/test/input_from_forward_iterator.hpp @@ -11,7 +11,7 @@ #ifndef BOOST_CONTAINER_TEST_FORWARD_TO_INPUT_ITERATOR_HPP #define BOOST_CONTAINER_TEST_FORWARD_TO_INPUT_ITERATOR_HPP -#include +#include namespace boost{ namespace container { @@ -19,11 +19,11 @@ namespace test{ template class input_iterator_wrapper - : public std::iterator< std::input_iterator_tag - , typename std::iterator_traits::value_type - , typename std::iterator_traits::difference_type - , typename std::iterator_traits::pointer - , typename std::iterator_traits::reference + : public boost::container::iterator< std::input_iterator_tag + , typename boost::container::iterator_traits::value_type + , typename boost::container::iterator_traits::difference_type + , typename boost::container::iterator_traits::pointer + , typename boost::container::iterator_traits::reference > { FwdIterator m_it; @@ -46,10 +46,10 @@ class input_iterator_wrapper //Default destructor... //~input_iterator_wrapper(); - typename std::iterator_traits::reference operator*() const + typename boost::container::iterator_traits::reference operator*() const { return *m_it; } - typename std::iterator_traits::pointer operator->() const + typename boost::container::iterator_traits::pointer operator->() const { return m_it.operator->(); } input_iterator_wrapper& operator++() diff --git a/test/list_test.cpp b/test/list_test.cpp index 1c035a7..d3029f3 100644 --- a/test/list_test.cpp +++ b/test/list_test.cpp @@ -53,9 +53,9 @@ template class boost::container::list namespace container_detail { -template class iterator +template class iterator_from_iiterator >::container_type::iterator, true >; -template class iterator +template class iterator_from_iiterator >::container_type::iterator, false>; } diff --git a/test/list_test.hpp b/test/list_test.hpp index d506dec..606dc60 100644 --- a/test/list_test.hpp +++ b/test/list_test.hpp @@ -12,18 +12,20 @@ #define BOOST_CONTAINER_TEST_LIST_TEST_HEADER #include +#include #include "check_equal_containers.hpp" -#include -#include -#include -#include #include "print_container.hpp" #include "input_from_forward_iterator.hpp" #include #include -#include #include +#include +#include +#include +#include //std::greater +#include + namespace boost{ namespace container { namespace test{ @@ -229,7 +231,7 @@ int list_test (bool copied_allocators_equal = true) boostlist.insert(boostlist.begin() ,boost::make_move_iterator(&aux_vect[0]) ,boost::make_move_iterator(&aux_vect[50])); - if(it_insert != boostlist.begin() || std::distance(it_insert, old_begin) != 50) + if(it_insert != boostlist.begin() || boost::container::iterator_distance(it_insert, old_begin) != 50) return 1; stdlist.insert(stdlist.begin(), &aux_vect2[0], &aux_vect2[50]); @@ -249,7 +251,7 @@ int list_test (bool copied_allocators_equal = true) it_insert = boostlist.insert(boostlist.end() ,boost::make_move_iterator(make_input_from_forward_iterator(&aux_vect[0])) ,boost::make_move_iterator(make_input_from_forward_iterator(&aux_vect[50]))); - if(std::distance(it_insert, boostlist.end()) != 50) + if(boost::container::iterator_distance(it_insert, boostlist.end()) != 50) return 1; stdlist.insert(stdlist.end(), &aux_vect2[0], &aux_vect2[50]); if(!CheckEqualContainers(boostlist, stdlist)) diff --git a/test/map_test.cpp b/test/map_test.cpp index 505555f..4ff5721 100644 --- a/test/map_test.cpp +++ b/test/map_test.cpp @@ -12,7 +12,9 @@ #include #include #include + #include +#include #include "print_container.hpp" #include "movable_int.hpp" diff --git a/test/map_test.hpp b/test/map_test.hpp index f1894c6..502b00a 100644 --- a/test/map_test.hpp +++ b/test/map_test.hpp @@ -13,16 +13,16 @@ #include #include "check_equal_containers.hpp" -#include -#include -#include #include "print_container.hpp" #include #include #include #include #include + +#include //std::pair #include +#include #include #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME rebalance @@ -506,8 +506,8 @@ int map_test() std::pair sret = stdmultimap.equal_range(stdmultimap.begin()->first); - if( std::distance(bret.first, bret.second) != - std::distance(sret.first, sret.second) ){ + if( boost::container::iterator_distance(bret.first, bret.second) != + boost::container::iterator_distance(sret.first, sret.second) ){ return 1; } } diff --git a/test/static_vector_test.cpp b/test/static_vector_test.cpp index 69b5dd1..eb48f62 100644 --- a/test/static_vector_test.cpp +++ b/test/static_vector_test.cpp @@ -10,13 +10,13 @@ #include #include #include +#include +#include +#include #include #include -#include -#include - #include "static_vector_test.hpp" namespace boost { @@ -208,7 +208,7 @@ void test_pop_back_nd() template void test_compare_ranges(It1 first1, It1 last1, It2 first2, It2 last2) { - BOOST_TEST(std::distance(first1, last1) == std::distance(first2, last2)); + BOOST_TEST(boost::container::iterator_distance(first1, last1) == boost::container::iterator_distance(first2, last2)); for ( ; first1 != last1 && first2 != last2 ; ++first1, ++first2 ) BOOST_TEST(*first1 == *first2); } @@ -352,7 +352,7 @@ void test_insert(SV const& s, C const& c) static_vector s1(s); typename C::const_iterator it = c.begin(); - std::advance(it, n); + boost::container::iterator_advance(it, n); typename static_vector::iterator it1 = s1.insert(s1.begin() + i, c.begin(), it); diff --git a/test/string_test.cpp b/test/string_test.cpp index caa7eac..d43f9f7 100644 --- a/test/string_test.cpp +++ b/test/string_test.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include //equal() #include #include #include @@ -68,7 +68,7 @@ template bool CheckEqualStringVector(StrVector1 *strvect1, StrVector2 *strvect2) { StringEqual comp; - return std::equal(strvect1->begin(), strvect1->end(), + return boost::container::algo_equal(strvect1->begin(), strvect1->end(), strvect2->begin(), comp); } diff --git a/test/vector_test.hpp b/test/vector_test.hpp index 2e7fb82..197caae 100644 --- a/test/vector_test.hpp +++ b/test/vector_test.hpp @@ -12,7 +12,7 @@ #define BOOST_CONTAINER_TEST_VECTOR_TEST_HEADER #include -#include + #include #include #include @@ -21,21 +21,25 @@ #include #include -#include "print_container.hpp" -#include "check_equal_containers.hpp" -#include "movable_int.hpp" -#include -#include -#include "emplace_test.hpp" -#include "input_from_forward_iterator.hpp" #include #include #include #include #include + +#include "print_container.hpp" +#include "check_equal_containers.hpp" +#include "movable_int.hpp" +#include "emplace_test.hpp" +#include "input_from_forward_iterator.hpp" #include "insert_test.hpp" #include "container_common_tests.hpp" +#include +#include +#include + + namespace boost{ namespace container { namespace test{ @@ -168,7 +172,7 @@ int vector_test() boostvector.insert(boostvector.end() ,boost::make_move_iterator(&aux_vect[0]) ,boost::make_move_iterator(aux_vect + 50)); - if(std::size_t(std::distance(insert_it, boostvector.end())) != 50) return 1; + if(std::size_t(boost::container::iterator_distance(insert_it, boostvector.end())) != 50) return 1; stdvector.insert(stdvector.end(), aux_vect2, aux_vect2 + 50); if(!test::CheckEqualContainers(boostvector, stdvector)) return 1;