forked from boostorg/container
Refactored uses of <iterator> and <algorithm> to avoid dependencies where possible.
This commit is contained in:
@ -13,7 +13,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <boost/timer/timer.hpp>
|
||||
#include <algorithm>
|
||||
#include <algorithm> //sort
|
||||
#include <exception>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
@ -18,15 +18,12 @@
|
||||
#include <boost/container/detail/config_begin.hpp>
|
||||
#include <boost/container/detail/workaround.hpp>
|
||||
#include <boost/container/detail/preprocessor.hpp>
|
||||
|
||||
#include <boost/container/detail/algorithm.hpp> //algo_equal(), algo_lexicographical_compare
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
#include <boost/container/detail/iterators.hpp>
|
||||
|
||||
#include "varray_util.hpp"
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
#include <stdexcept>
|
||||
#endif // BOOST_NO_EXCEPTIONS
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/swap.hpp>
|
||||
@ -38,6 +35,10 @@
|
||||
#include <boost/type_traits/alignment_of.hpp>
|
||||
#include <boost/type_traits/aligned_storage.hpp>
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
#include <stdexcept>
|
||||
#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<iterator> reverse_iterator;
|
||||
typedef boost::container::reverse_iterator<iterator> reverse_iterator;
|
||||
//! @brief The const reverse iterator.
|
||||
typedef container_detail::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef boost::container::reverse_iterator<const_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 <typename Iterator>
|
||||
iterator insert(iterator position, Iterator first, Iterator last)
|
||||
{
|
||||
typedef typename std::iterator_traits<Iterator>::iterator_category category;
|
||||
typedef typename boost::container::iterator_traits<Iterator>::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 <typename Iterator>
|
||||
void assign(Iterator first, Iterator last)
|
||||
{
|
||||
typedef typename std::iterator_traits<Iterator>::iterator_category category;
|
||||
typedef typename boost::container::iterator_traits<Iterator>::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<Iterator>::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<std::size_t>(d) ? m_size + count : Capacity + 1); // may throw
|
||||
@ -1760,8 +1760,7 @@ private:
|
||||
}
|
||||
else
|
||||
{
|
||||
typename boost::iterator_difference<Iterator>::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<Iterator>::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<iterator> reverse_iterator;
|
||||
typedef container_detail::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef boost::container::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef boost::container::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
// nothrow
|
||||
varray() {}
|
||||
@ -1931,7 +1929,7 @@ public:
|
||||
template <typename Iterator>
|
||||
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 <typename Iterator>
|
||||
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 <typename Iterator>
|
||||
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<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
|
||||
bool operator== (varray<V, C1, S1> const& x, varray<V, C2, S2> 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<V, C1, S1> const& x, varray<V, C2, S2> const& y)
|
||||
template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
|
||||
bool operator< (varray<V, C1, S1> const& x, varray<V, C2, S2> 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.
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <boost/type_traits/has_trivial_constructor.hpp>
|
||||
#include <boost/type_traits/has_trivial_destructor.hpp>
|
||||
#include <boost/move/traits.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/config.hpp>
|
||||
@ -113,10 +113,10 @@ struct are_corresponding :
|
||||
::boost::mpl::and_<
|
||||
::boost::is_same<
|
||||
::boost::remove_const<
|
||||
typename ::boost::iterator_value<I>::type
|
||||
typename ::boost::container::iterator_traits<I>::value_type
|
||||
>,
|
||||
::boost::remove_const<
|
||||
typename ::boost::iterator_value<O>::type
|
||||
typename ::boost::container::iterator_traits<O>::value_type
|
||||
>
|
||||
>,
|
||||
are_elements_contiguous<I>,
|
||||
@ -128,7 +128,7 @@ template <typename I, typename V>
|
||||
struct is_corresponding_value :
|
||||
::boost::is_same<
|
||||
::boost::remove_const<
|
||||
typename ::boost::iterator_value<I>::type
|
||||
typename ::boost::container::iterator_traits<I>::value_type
|
||||
>,
|
||||
::boost::remove_const<V>
|
||||
>
|
||||
@ -145,7 +145,7 @@ template <typename I>
|
||||
void destroy_dispatch(I first, I last,
|
||||
boost::false_type const& /*has_trivial_destructor*/)
|
||||
{
|
||||
typedef typename boost::iterator_value<I>::type value_type;
|
||||
typedef typename ::boost::container::iterator_traits<I>::value_type value_type;
|
||||
for ( ; first != last ; ++first )
|
||||
first->~value_type();
|
||||
}
|
||||
@ -153,7 +153,7 @@ void destroy_dispatch(I first, I last,
|
||||
template <typename I>
|
||||
void destroy(I first, I last)
|
||||
{
|
||||
typedef typename boost::iterator_value<I>::type value_type;
|
||||
typedef typename ::boost::container::iterator_traits<I>::value_type value_type;
|
||||
destroy_dispatch(first, last, has_trivial_destructor<value_type>());
|
||||
}
|
||||
|
||||
@ -168,14 +168,14 @@ template <typename I>
|
||||
void destroy_dispatch(I pos,
|
||||
boost::false_type const& /*has_trivial_destructor*/)
|
||||
{
|
||||
typedef typename boost::iterator_value<I>::type value_type;
|
||||
typedef typename ::boost::container::iterator_traits<I>::value_type value_type;
|
||||
pos->~value_type();
|
||||
}
|
||||
|
||||
template <typename I>
|
||||
void destroy(I pos)
|
||||
{
|
||||
typedef typename boost::iterator_value<I>::type value_type;
|
||||
typedef typename ::boost::container::iterator_traits<I>::value_type value_type;
|
||||
destroy_dispatch(pos, has_trivial_destructor<value_type>());
|
||||
}
|
||||
|
||||
@ -185,9 +185,8 @@ template <typename I, typename O>
|
||||
inline O copy_dispatch(I first, I last, O dst,
|
||||
boost::mpl::bool_<true> const& /*use_memmove*/)
|
||||
{
|
||||
typedef typename boost::iterator_value<I>::type value_type;
|
||||
typename boost::iterator_difference<I>::type d = std::distance(first, last);
|
||||
|
||||
typedef typename ::boost::container::iterator_traits<I>::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;
|
||||
}
|
||||
@ -206,7 +205,7 @@ inline O copy(I first, I last, O dst)
|
||||
::boost::mpl::and_<
|
||||
are_corresponding<I, O>,
|
||||
::boost::has_trivial_assign<
|
||||
typename ::boost::iterator_value<O>::type
|
||||
typename ::boost::container::iterator_traits<O>::value_type
|
||||
>
|
||||
>::type
|
||||
use_memmove;
|
||||
@ -221,9 +220,8 @@ inline
|
||||
O uninitialized_copy_dispatch(I first, I last, O dst,
|
||||
boost::mpl::bool_<true> const& /*use_memcpy*/)
|
||||
{
|
||||
typedef typename boost::iterator_value<I>::type value_type;
|
||||
typename boost::iterator_difference<I>::type d = std::distance(first, last);
|
||||
|
||||
typedef typename ::boost::container::iterator_traits<I>::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;
|
||||
}
|
||||
@ -244,7 +242,7 @@ F uninitialized_copy(I first, I last, F dst)
|
||||
::boost::mpl::and_<
|
||||
are_corresponding<I, F>,
|
||||
::boost::has_trivial_copy<
|
||||
typename ::boost::iterator_value<F>::type
|
||||
typename ::boost::container::iterator_traits<F>::value_type
|
||||
>
|
||||
>::type
|
||||
use_memcpy;
|
||||
@ -259,9 +257,8 @@ inline
|
||||
O uninitialized_move_dispatch(I first, I last, O dst,
|
||||
boost::mpl::bool_<true> const& /*use_memcpy*/)
|
||||
{
|
||||
typedef typename boost::iterator_value<I>::type value_type;
|
||||
typename boost::iterator_difference<I>::type d = std::distance(first, last);
|
||||
|
||||
typedef typename ::boost::container::iterator_traits<I>::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;
|
||||
}
|
||||
@ -277,7 +274,7 @@ O uninitialized_move_dispatch(I first, I last, O dst,
|
||||
|
||||
BOOST_TRY
|
||||
{
|
||||
typedef typename std::iterator_traits<O>::value_type value_type;
|
||||
typedef typename boost::container::iterator_traits<O>::value_type value_type;
|
||||
for (; first != last; ++first, ++o )
|
||||
new (boost::addressof(*o)) value_type(boost::move(*first));
|
||||
}
|
||||
@ -299,7 +296,7 @@ O uninitialized_move(I first, I last, O dst)
|
||||
::boost::mpl::and_<
|
||||
are_corresponding<I, O>,
|
||||
::boost::has_trivial_copy<
|
||||
typename ::boost::iterator_value<O>::type
|
||||
typename ::boost::container::iterator_traits<O>::value_type
|
||||
>
|
||||
>::type
|
||||
use_memcpy;
|
||||
@ -316,10 +313,9 @@ inline
|
||||
O move_dispatch(I first, I last, O dst,
|
||||
boost::mpl::bool_<true> const& /*use_memmove*/)
|
||||
{
|
||||
typedef typename boost::iterator_value<I>::type value_type;
|
||||
typename boost::iterator_difference<I>::type d = std::distance(first, last);
|
||||
|
||||
::memmove(boost::addressof(*dst), boost::addressof(*first), sizeof(value_type) * d);
|
||||
typedef typename ::boost::container::iterator_traits<I>::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;
|
||||
}
|
||||
|
||||
@ -339,7 +335,7 @@ O move(I first, I last, O dst)
|
||||
::boost::mpl::and_<
|
||||
are_corresponding<I, O>,
|
||||
::boost::has_trivial_assign<
|
||||
typename ::boost::iterator_value<O>::type
|
||||
typename ::boost::container::iterator_traits<O>::value_type
|
||||
>
|
||||
>::type
|
||||
use_memmove;
|
||||
@ -354,9 +350,8 @@ inline
|
||||
BDO move_backward_dispatch(BDI first, BDI last, BDO dst,
|
||||
boost::mpl::bool_<true> const& /*use_memmove*/)
|
||||
{
|
||||
typedef typename boost::iterator_value<BDI>::type value_type;
|
||||
typename boost::iterator_difference<BDI>::type d = std::distance(first, last);
|
||||
|
||||
typedef typename ::boost::container::iterator_traits<BDI>::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<BDI, BDO>,
|
||||
::boost::has_trivial_assign<
|
||||
typename ::boost::iterator_value<BDO>::type
|
||||
typename ::boost::container::iterator_traits<BDO>::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<O>::type
|
||||
typename ::boost::container::iterator_traits<O>::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<O>::type
|
||||
typename ::boost::container::iterator_traits<O>::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<I>::type value_type;
|
||||
typedef typename ::boost::container::iterator_traits<I>::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<I>::type value_type;
|
||||
typedef typename ::boost::container::iterator_traits<I>::value_type value_type;
|
||||
I it = first;
|
||||
|
||||
BOOST_TRY
|
||||
@ -492,7 +487,7 @@ template <typename I, typename DisableTrivialInit>
|
||||
inline
|
||||
void uninitialized_fill(I first, I last, DisableTrivialInit const& disable_trivial_init)
|
||||
{
|
||||
typedef typename boost::iterator_value<I>::type value_type;
|
||||
typedef typename ::boost::container::iterator_traits<I>::value_type value_type;
|
||||
uninitialized_fill_dispatch(first, last, boost::has_trivial_constructor<value_type>(), disable_trivial_init); // may throw
|
||||
}
|
||||
|
||||
@ -507,7 +502,7 @@ template <typename I>
|
||||
inline
|
||||
void construct_dispatch(boost::mpl::bool_<false> const& /*dont_init*/, I pos)
|
||||
{
|
||||
typedef typename ::boost::iterator_value<I>::type value_type;
|
||||
typedef typename ::boost::container::iterator_traits<I>::value_type value_type;
|
||||
new (static_cast<void*>(::boost::addressof(*pos))) value_type(); // may throw
|
||||
}
|
||||
|
||||
@ -515,7 +510,7 @@ template <typename DisableTrivialInit, typename I>
|
||||
inline
|
||||
void construct(DisableTrivialInit const&, I pos)
|
||||
{
|
||||
typedef typename ::boost::iterator_value<I>::type value_type;
|
||||
typedef typename ::boost::container::iterator_traits<I>::value_type value_type;
|
||||
typedef typename ::boost::mpl::and_<
|
||||
boost::has_trivial_constructor<value_type>,
|
||||
DisableTrivialInit
|
||||
@ -539,7 +534,7 @@ inline
|
||||
void construct_dispatch(I pos, P const& p,
|
||||
boost::mpl::bool_<false> const& /*use_memcpy*/)
|
||||
{
|
||||
typedef typename boost::iterator_value<I>::type V;
|
||||
typedef typename ::boost::container::iterator_traits<I>::value_type V;
|
||||
new (static_cast<void*>(boost::addressof(*pos))) V(p); // may throw
|
||||
}
|
||||
|
||||
@ -564,7 +559,7 @@ template <typename DisableTrivialInit, typename I, typename P>
|
||||
inline
|
||||
void construct(DisableTrivialInit const&, I pos, BOOST_RV_REF(P) p)
|
||||
{
|
||||
typedef typename boost::iterator_value<I>::type V;
|
||||
typedef typename ::boost::container::iterator_traits<I>::value_type V;
|
||||
new (static_cast<void*>(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<I>::type V;
|
||||
typedef typename ::boost::container::iterator_traits<I>::value_type V;
|
||||
new (static_cast<void*>(boost::addressof(*pos))) V(::boost::forward<Args>(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<I>::type V; \
|
||||
typedef typename ::boost::container::iterator_traits<I>::value_type V; \
|
||||
new \
|
||||
(static_cast<void*>(boost::addressof(*pos))) \
|
||||
V(p, BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); /*may throw*/ \
|
||||
|
@ -32,8 +32,7 @@
|
||||
#include <boost/utility/addressof.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
|
@ -24,11 +24,9 @@
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
#include <boost/container/container_fwd.hpp>
|
||||
#include <boost/container/throw_exception.hpp>
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/type_traits/has_trivial_destructor.hpp>
|
||||
#include <boost/type_traits/has_trivial_copy.hpp>
|
||||
@ -41,8 +39,12 @@
|
||||
#include <boost/move/detail/move_helpers.hpp>
|
||||
#include <boost/move/traits.hpp>
|
||||
#include <boost/container/detail/advanced_insert_int.hpp>
|
||||
#include <boost/container/detail/algorithm.hpp> //algo_equal(), algo_lexicographical_compare
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include <memory> //std::allocator
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
#include <initializer_list>
|
||||
#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<Allocator>
|
||||
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<iterator>) reverse_iterator;
|
||||
typedef BOOST_CONTAINER_IMPDEF(container_detail::reverse_iterator<const_iterator>) const_reverse_iterator;
|
||||
typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<iterator>) reverse_iterator;
|
||||
typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<const_iterator>) const_reverse_iterator;
|
||||
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
|
||||
@ -604,7 +606,7 @@ class deque : protected deque_base<Allocator>
|
||||
)
|
||||
: Base(a)
|
||||
{
|
||||
typedef typename std::iterator_traits<InIt>::iterator_category ItCat;
|
||||
typedef typename boost::container::iterator_traits<InIt>::iterator_category ItCat;
|
||||
this->priv_range_initialize(first, last, ItCat());
|
||||
}
|
||||
|
||||
@ -825,10 +827,10 @@ class deque : protected deque_base<Allocator>
|
||||
>::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<Allocator>
|
||||
//! <b>Throws</b>: If memory allocation throws, T's constructor from a
|
||||
//! dereferenced InIt throws or T's copy constructor throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to std::distance [first, last).
|
||||
//! <b>Complexity</b>: Linear to distance [first, last).
|
||||
template <class InIt>
|
||||
iterator insert(const_iterator pos, InIt first, InIt last
|
||||
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
@ -1507,7 +1509,7 @@ class deque : protected deque_base<Allocator>
|
||||
//! <b>Throws</b>: If memory allocation throws, T's constructor from a
|
||||
//! dereferenced std::initializer_list throws or T's copy constructor throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to std::distance [il.begin(), il.end()).
|
||||
//! <b>Complexity</b>: Linear to distance [il.begin(), il.end()).
|
||||
iterator insert(const_iterator pos, std::initializer_list<value_type> il)
|
||||
{ return insert(pos, il.begin(), il.end()); }
|
||||
#endif
|
||||
@ -1524,7 +1526,7 @@ class deque : protected deque_base<Allocator>
|
||||
)
|
||||
{
|
||||
container_detail::insert_range_proxy<Allocator, FwdIt, iterator> 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<Allocator>
|
||||
//!
|
||||
//! <b>Complexity</b>: 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()); }
|
||||
|
||||
//! <b>Effects</b>: Returns true if x and y are unequal
|
||||
//!
|
||||
@ -1679,7 +1681,7 @@ class deque : protected deque_base<Allocator>
|
||||
//!
|
||||
//! <b>Complexity</b>: 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()); }
|
||||
|
||||
//! <b>Effects</b>: Returns true if x is greater than y
|
||||
//!
|
||||
@ -1979,7 +1981,7 @@ class deque : protected deque_base<Allocator>
|
||||
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<Allocator>
|
||||
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;
|
||||
}
|
||||
|
@ -25,8 +25,9 @@
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
#include <boost/container/detail/utilities.hpp>
|
||||
#include <boost/container/detail/type_traits.hpp>
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
#include <boost/container/detail/iterators.hpp>
|
||||
#include <iterator> //std::iterator_traits
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
|
||||
@ -186,13 +187,13 @@ struct insert_move_proxy
|
||||
};
|
||||
|
||||
template<class It, class A>
|
||||
insert_move_proxy<A, It> get_insert_value_proxy(BOOST_RV_REF(typename std::iterator_traits<It>::value_type) v)
|
||||
insert_move_proxy<A, It> get_insert_value_proxy(BOOST_RV_REF(typename boost::container::iterator_traits<It>::value_type) v)
|
||||
{
|
||||
return insert_move_proxy<A, It>(v);
|
||||
}
|
||||
|
||||
template<class It, class A>
|
||||
insert_copy_proxy<A, It> get_insert_value_proxy(const typename std::iterator_traits<It>::value_type &v)
|
||||
insert_copy_proxy<A, It> get_insert_value_proxy(const typename boost::container::iterator_traits<It>::value_type &v)
|
||||
{
|
||||
return insert_copy_proxy<A, It>(v);
|
||||
}
|
||||
|
60
include/boost/container/detail/algorithm.hpp
Normal file
60
include/boost/container/detail/algorithm.hpp
Normal file
@ -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<class InputIt1, class InputIt2>
|
||||
bool algo_equal(InputIt1 first1, InputIt1 last1, InputIt2 first2)
|
||||
{
|
||||
for (; first1 != last1; ++first1, ++first2) {
|
||||
if (!(*first1 == *first2)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template<class InputIt1, class InputIt2, class BinaryPredicate>
|
||||
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 <class InputIterator1, class InputIterator2>
|
||||
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
|
@ -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 <boost/container/detail/config_begin.hpp>
|
||||
#include <boost/container/detail/workaround.hpp>
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
#include <boost/container/detail/iterators.hpp>
|
||||
|
||||
@ -56,7 +54,5 @@ inline void construct_in_place(A &a, T *dest, emplace_iterator<U, EF, D> ei)
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
#include <boost/container/detail/config_end.hpp>
|
||||
|
||||
#endif //#ifndef BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP
|
||||
#endif //#ifndef BOOST_CONTAINER_DETAIL_CONSTRUCT_IN_PLACE_HPP
|
||||
|
@ -20,10 +20,6 @@
|
||||
|
||||
#include <boost/container/container_fwd.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
|
||||
#include <boost/type_traits/has_trivial_destructor.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
@ -32,6 +28,8 @@
|
||||
#include <boost/container/vector.hpp>
|
||||
#include <boost/container/detail/value_init.hpp>
|
||||
#include <boost/container/detail/destroyers.hpp>
|
||||
#include <boost/container/detail/algorithm.hpp> //algo_equal(), algo_lexicographical_compare
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
#ifdef BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
@ -39,10 +37,10 @@
|
||||
#include <boost/aligned_storage.hpp>
|
||||
#include <boost/move/make_unique.hpp>
|
||||
|
||||
#include <utility> //std::pair
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace container {
|
||||
|
||||
namespace container_detail {
|
||||
|
||||
template<class Compare, class Value, class KeyOfValue>
|
||||
@ -90,10 +88,8 @@ struct get_flat_tree_iterators
|
||||
typedef typename boost::container::container_detail::
|
||||
vec_iterator<Pointer, true > const_iterator;
|
||||
#endif //BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
|
||||
typedef boost::container::container_detail::
|
||||
reverse_iterator<iterator> reverse_iterator;
|
||||
typedef boost::container::container_detail::
|
||||
reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef boost::container::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef boost::container::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
};
|
||||
|
||||
template <class Key, class Value, class KeyOfValue,
|
||||
@ -428,7 +424,7 @@ class flat_tree
|
||||
#endif
|
||||
)
|
||||
{
|
||||
const size_type len = static_cast<size_type>(std::distance(first, last));
|
||||
const size_type len = static_cast<size_type>(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<size_type>(std::distance(first, last));
|
||||
const size_type len = static_cast<size_type>(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 <class BidirIt>
|
||||
void priv_insert_ordered_range(const bool unique_values, BidirIt first, BidirIt last)
|
||||
{
|
||||
size_type len = static_cast<size_type>(std::distance(first, last));
|
||||
size_type len = static_cast<size_type>(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<BidirIt>::value_type
|
||||
//Get the insertion position for each key, use iterator_traits<BidirIt>::value_type
|
||||
//because it can be different from container::value_type
|
||||
//(e.g. conversion between std::pair<A, B> -> boost::container::pair<A, B>
|
||||
const typename std::iterator_traits<BidirIt>::value_type & val = *first;
|
||||
const typename boost::container::iterator_traits<BidirIt>::value_type & val = *first;
|
||||
pos = const_cast<const flat_tree&>(*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);
|
||||
}
|
||||
|
33
include/boost/container/detail/iterator.hpp
Normal file
33
include/boost/container/detail/iterator.hpp
Normal file
@ -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 <boost/intrusive/detail/iterator.hpp>
|
||||
|
||||
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
|
@ -32,14 +32,14 @@
|
||||
#include <boost/container/detail/preprocessor.hpp>
|
||||
#endif
|
||||
|
||||
#include <iterator>
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
|
||||
template <class T, class Difference = std::ptrdiff_t>
|
||||
class constant_iterator
|
||||
: public std::iterator
|
||||
: public ::boost::container::iterator
|
||||
<std::random_access_iterator_tag, T, Difference, const T*, const T &>
|
||||
{
|
||||
typedef constant_iterator<T, Difference> this_type;
|
||||
@ -150,7 +150,7 @@ class constant_iterator
|
||||
|
||||
template <class T, class Difference>
|
||||
class value_init_construct_iterator
|
||||
: public std::iterator
|
||||
: public ::boost::container::iterator
|
||||
<std::random_access_iterator_tag, T, Difference, const T*, const T &>
|
||||
{
|
||||
typedef value_init_construct_iterator<T, Difference> this_type;
|
||||
@ -261,7 +261,7 @@ class value_init_construct_iterator
|
||||
|
||||
template <class T, class Difference>
|
||||
class default_init_construct_iterator
|
||||
: public std::iterator
|
||||
: public ::boost::container::iterator
|
||||
<std::random_access_iterator_tag, T, Difference, const T*, const T &>
|
||||
{
|
||||
typedef default_init_construct_iterator<T, Difference> this_type;
|
||||
@ -373,7 +373,7 @@ class default_init_construct_iterator
|
||||
|
||||
template <class T, class Difference = std::ptrdiff_t>
|
||||
class repeat_iterator
|
||||
: public std::iterator
|
||||
: public ::boost::container::iterator
|
||||
<std::random_access_iterator_tag, T, Difference>
|
||||
{
|
||||
typedef repeat_iterator<T, Difference> this_type;
|
||||
@ -483,7 +483,7 @@ class repeat_iterator
|
||||
|
||||
template <class T, class EmplaceFunctor, class Difference /*= std::ptrdiff_t*/>
|
||||
class emplace_iterator
|
||||
: public std::iterator
|
||||
: public ::boost::container::iterator
|
||||
<std::random_access_iterator_tag, T, Difference, const T*, const T &>
|
||||
{
|
||||
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<it_value_type>::type value_type;
|
||||
typedef typename std::iterator_traits<IIterator>::pointer it_pointer;
|
||||
typedef typename std::iterator_traits<IIterator>::difference_type difference_type;
|
||||
typedef typename boost::container::iterator_traits<IIterator>::pointer it_pointer;
|
||||
typedef typename boost::container::iterator_traits<IIterator>::difference_type difference_type;
|
||||
typedef typename ::boost::intrusive::pointer_traits<it_pointer>::
|
||||
template rebind_pointer<value_type>::type pointer;
|
||||
typedef typename ::boost::intrusive::pointer_traits<it_pointer>::
|
||||
@ -723,9 +723,9 @@ struct iiterator_types
|
||||
};
|
||||
|
||||
template<class IIterator, bool IsConst>
|
||||
struct std_iterator
|
||||
struct iterator_types
|
||||
{
|
||||
typedef typename std::iterator
|
||||
typedef typename ::boost::container::iterator
|
||||
< typename iiterator_types<IIterator>::iterator_category
|
||||
, typename iiterator_types<IIterator>::value_type
|
||||
, typename iiterator_types<IIterator>::difference_type
|
||||
@ -734,9 +734,9 @@ struct std_iterator
|
||||
};
|
||||
|
||||
template<class IIterator>
|
||||
struct std_iterator<IIterator, false>
|
||||
struct iterator_types<IIterator, false>
|
||||
{
|
||||
typedef typename std::iterator
|
||||
typedef typename ::boost::container::iterator
|
||||
< typename iiterator_types<IIterator>::iterator_category
|
||||
, typename iiterator_types<IIterator>::value_type
|
||||
, typename iiterator_types<IIterator>::difference_type
|
||||
@ -745,9 +745,9 @@ struct std_iterator<IIterator, false>
|
||||
};
|
||||
|
||||
template<class IIterator, bool IsConst>
|
||||
class iterator
|
||||
class iterator_from_iiterator
|
||||
{
|
||||
typedef typename std_iterator<IIterator, IsConst>::type types_t;
|
||||
typedef typename iterator_types<IIterator, IsConst>::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<IIterator, false> const& other) BOOST_CONTAINER_NOEXCEPT
|
||||
iterator_from_iiterator(iterator_from_iiterator<IIterator, false> 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<iterator>::value));
|
||||
//If the iterator_from_iiterator is not a bidirectional iterator, operator-- should not exist
|
||||
BOOST_STATIC_ASSERT((is_bidirectional_iterator<iterator_from_iiterator>::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 {
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include <boost/container/detail/preprocessor.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/container/detail/algorithms.hpp>
|
||||
#include <boost/container/detail/construct_in_place.hpp>
|
||||
|
||||
|
||||
|
||||
|
@ -25,8 +25,6 @@
|
||||
#include <boost/intrusive/slist.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <cstddef>
|
||||
#include <functional> //std::unary_function
|
||||
#include <algorithm> //std::swap
|
||||
#include <cassert>
|
||||
|
||||
namespace boost {
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <boost/container/detail/type_traits.hpp>
|
||||
|
||||
#include <utility> //std::pair
|
||||
#include <algorithm> //std::swap
|
||||
#include <boost/container/detail/swap.hpp> //swap
|
||||
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
77
include/boost/container/detail/swap.hpp
Normal file
77
include/boost/container/detail/swap.hpp
Normal file
@ -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 <cstddef> //for std::size_t
|
||||
#include <boost/move/utility_core.hpp> //for boost::move
|
||||
|
||||
namespace boost_container_swap_move {
|
||||
template<class T>
|
||||
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<class T>
|
||||
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<class T, std::size_t N>
|
||||
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<class T1, class T2>
|
||||
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
|
@ -20,9 +20,7 @@
|
||||
|
||||
#include <boost/container/detail/config_begin.hpp>
|
||||
#include <boost/container/detail/workaround.hpp>
|
||||
|
||||
#include <boost/container/detail/type_traits.hpp>
|
||||
#include <iterator>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
@ -58,7 +56,7 @@ struct operator_arrow_proxy<T&>
|
||||
template <class Iterator, class UnaryFunction>
|
||||
class transform_iterator
|
||||
: public UnaryFunction
|
||||
, public std::iterator
|
||||
, public boost::container::iterator
|
||||
< typename Iterator::iterator_category
|
||||
, typename container_detail::remove_reference<typename UnaryFunction::result_type>::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 <class Iterator, class UnaryFunc>
|
||||
|
@ -25,9 +25,11 @@
|
||||
#include <boost/container/detail/destroyers.hpp>
|
||||
#include <boost/container/detail/pair.hpp>
|
||||
#include <boost/container/detail/type_traits.hpp>
|
||||
#include <boost/container/detail/algorithm.hpp> //algo_equal(), algo_lexicographical_compare
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
#include <boost/container/options.hpp>
|
||||
#include <boost/container/detail/compare_functors.hpp>
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
//
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/intrusive/rbtree.hpp>
|
||||
@ -44,8 +46,6 @@
|
||||
#endif
|
||||
|
||||
#include <utility> //std::pair
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
@ -523,10 +523,10 @@ class tree
|
||||
typedef key_node_compare<value_compare, Node> KeyNodeCompare;
|
||||
|
||||
public:
|
||||
typedef container_detail::iterator<iiterator, false> iterator;
|
||||
typedef container_detail::iterator<iiterator, true > const_iterator;
|
||||
typedef container_detail::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef container_detail::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef container_detail::iterator_from_iiterator<iiterator, false> iterator;
|
||||
typedef container_detail::iterator_from_iiterator<iiterator, true > const_iterator;
|
||||
typedef boost::container::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef boost::container::reverse_iterator<const_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<Node, Icont>(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<Node, Icont>(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); }
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <boost/type_traits/has_trivial_destructor.hpp>
|
||||
#include <boost/type_traits/has_trivial_copy.hpp>
|
||||
#include <boost/type_traits/has_trivial_assign.hpp>
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
#include <boost/type_traits/is_pod.hpp>
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
@ -42,8 +43,7 @@
|
||||
#include <boost/container/detail/memory_util.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/aligned_storage.hpp>
|
||||
#include <iterator>
|
||||
#include <utility> //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 <typename T>
|
||||
@ -174,14 +175,14 @@ inline T* iterator_to_pointer(T* i)
|
||||
{ return i; }
|
||||
|
||||
template <class Iterator>
|
||||
inline typename std::iterator_traits<Iterator>::pointer
|
||||
inline typename boost::container::iterator_traits<Iterator>::pointer
|
||||
iterator_to_pointer(const Iterator &i)
|
||||
{ return i.operator->(); }
|
||||
|
||||
template <class Iterator>
|
||||
inline
|
||||
typename boost::intrusive::pointer_traits
|
||||
<typename std::iterator_traits<Iterator>::pointer>::element_type*
|
||||
<typename boost::container::iterator_traits<Iterator>::pointer>::element_type*
|
||||
iterator_to_raw_pointer(const Iterator &i)
|
||||
{ return (to_raw_pointer)((iterator_to_pointer)(i)); }
|
||||
|
||||
@ -304,8 +305,8 @@ template <typename I, typename O>
|
||||
struct are_contiguous_and_same
|
||||
{
|
||||
static const bool is_same_io =
|
||||
is_same< typename remove_const< typename ::std::iterator_traits<I>::value_type >::type
|
||||
, typename ::std::iterator_traits<O>::value_type
|
||||
is_same< typename remove_const< typename ::boost::container::iterator_traits<I>::value_type >::type
|
||||
, typename ::boost::container::iterator_traits<O>::value_type
|
||||
>::value;
|
||||
static const bool value = is_same_io &&
|
||||
are_elements_contiguous<I>::value &&
|
||||
@ -316,14 +317,14 @@ template <typename I, typename O>
|
||||
struct is_memtransfer_copy_assignable
|
||||
{
|
||||
static const bool value = are_contiguous_and_same<I, O>::value &&
|
||||
boost::has_trivial_assign< typename ::std::iterator_traits<I>::value_type >::value;
|
||||
boost::has_trivial_assign< typename ::boost::container::iterator_traits<I>::value_type >::value;
|
||||
};
|
||||
|
||||
template <typename I, typename O>
|
||||
struct is_memtransfer_copy_constructible
|
||||
{
|
||||
static const bool value = are_contiguous_and_same<I, O>::value &&
|
||||
boost::has_trivial_copy< typename ::std::iterator_traits<I>::value_type >::value;
|
||||
boost::has_trivial_copy< typename ::boost::container::iterator_traits<I>::value_type >::value;
|
||||
};
|
||||
|
||||
template <typename I, typename O, typename R>
|
||||
@ -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<I>::value_type value_type;
|
||||
typename std::iterator_traits<I>::difference_type n = std::distance(f, l);
|
||||
typedef typename boost::container::iterator_traits<I>::value_type value_type;
|
||||
typename boost::container::iterator_traits<I>::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
|
||||
<typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
F memmove_n(I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
|
||||
F memmove_n(I f, typename boost::container::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
|
||||
{
|
||||
typedef typename std::iterator_traits<I>::value_type value_type;
|
||||
typedef typename boost::container::iterator_traits<I>::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
|
||||
<typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
I memmove_n_source(I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
|
||||
I memmove_n_source(I f, typename boost::container::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
|
||||
{
|
||||
typedef typename std::iterator_traits<I>::value_type value_type;
|
||||
typedef typename boost::container::iterator_traits<I>::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
|
||||
<typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
I memmove_n_source_dest(I f, typename std::iterator_traits<I>::difference_type n, F &r) BOOST_CONTAINER_NOEXCEPT
|
||||
I memmove_n_source_dest(I f, typename boost::container::iterator_traits<I>::difference_type n, F &r) BOOST_CONTAINER_NOEXCEPT
|
||||
{
|
||||
typedef typename std::iterator_traits<I>::value_type value_type;
|
||||
typedef typename boost::container::iterator_traits<I>::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 <typename O>
|
||||
struct is_memzero_initializable
|
||||
{
|
||||
typedef typename ::std::iterator_traits<O>::value_type value_type;
|
||||
typedef typename ::boost::container::iterator_traits<O>::value_type value_type;
|
||||
static const bool value = are_elements_contiguous<O>::value &&
|
||||
( ::boost::is_integral<value_type>::value || ::boost::is_enum<value_type>::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<I, F, F>::type
|
||||
uninitialized_move_alloc_n(A &a, I f, typename std::iterator_traits<I>::difference_type n, F r)
|
||||
uninitialized_move_alloc_n(A &a, I f, typename boost::container::iterator_traits<I>::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<I, F, F>::type
|
||||
uninitialized_move_alloc_n(A &, I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
|
||||
uninitialized_move_alloc_n(A &, I f, typename boost::container::iterator_traits<I>::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<I, F, I>::type
|
||||
uninitialized_move_alloc_n_source(A &a, I f, typename std::iterator_traits<I>::difference_type n, F r)
|
||||
uninitialized_move_alloc_n_source(A &a, I f, typename boost::container::iterator_traits<I>::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<I, F, I>::type
|
||||
uninitialized_move_alloc_n_source(A &, I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
|
||||
uninitialized_move_alloc_n_source(A &, I f, typename boost::container::iterator_traits<I>::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<I, F, F>::type
|
||||
uninitialized_copy_alloc_n(A &a, I f, typename std::iterator_traits<I>::difference_type n, F r)
|
||||
uninitialized_copy_alloc_n(A &a, I f, typename boost::container::iterator_traits<I>::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<I, F, F>::type
|
||||
uninitialized_copy_alloc_n(A &, I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
|
||||
uninitialized_copy_alloc_n(A &, I f, typename boost::container::iterator_traits<I>::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<I, F, I>::type
|
||||
uninitialized_copy_alloc_n_source(A &a, I f, typename std::iterator_traits<I>::difference_type n, F r)
|
||||
uninitialized_copy_alloc_n_source(A &a, I f, typename boost::container::iterator_traits<I>::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<I, F, I>::type
|
||||
uninitialized_copy_alloc_n_source(A &, I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
|
||||
uninitialized_copy_alloc_n_source(A &, I f, typename boost::container::iterator_traits<I>::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<F, F>::type
|
||||
uninitialized_value_init_alloc_n(A &, typename allocator_traits<A>::difference_type n, F r)
|
||||
{
|
||||
typedef typename std::iterator_traits<F>::value_type value_type;
|
||||
typedef typename boost::container::iterator_traits<F>::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
|
||||
<typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
copy_n(I f, typename std::iterator_traits<I>::difference_type n, F r)
|
||||
copy_n(I f, typename boost::container::iterator_traits<I>::difference_type n, F r)
|
||||
{
|
||||
while (n--) {
|
||||
*r = *f;
|
||||
@ -898,7 +899,7 @@ template
|
||||
<typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
copy_n(I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
|
||||
copy_n(I f, typename boost::container::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
|
||||
{ return container_detail::memmove_n(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -911,7 +912,7 @@ template
|
||||
<typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
copy_n_source(I f, typename std::iterator_traits<I>::difference_type n, F r)
|
||||
copy_n_source(I f, typename boost::container::iterator_traits<I>::difference_type n, F r)
|
||||
{
|
||||
while (n--) {
|
||||
*r = *f;
|
||||
@ -924,7 +925,7 @@ template
|
||||
<typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
copy_n_source(I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
|
||||
copy_n_source(I f, typename boost::container::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
|
||||
{ return container_detail::memmove_n_source(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -937,7 +938,7 @@ template
|
||||
<typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
copy_n_source_dest(I f, typename std::iterator_traits<I>::difference_type n, F &r)
|
||||
copy_n_source_dest(I f, typename boost::container::iterator_traits<I>::difference_type n, F &r)
|
||||
{
|
||||
while (n--) {
|
||||
*r = *f;
|
||||
@ -950,7 +951,7 @@ template
|
||||
<typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
copy_n_source_dest(I f, typename std::iterator_traits<I>::difference_type n, F &r) BOOST_CONTAINER_NOEXCEPT
|
||||
copy_n_source_dest(I f, typename boost::container::iterator_traits<I>::difference_type n, F &r) BOOST_CONTAINER_NOEXCEPT
|
||||
{ return container_detail::memmove_n_source_dest(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -989,7 +990,7 @@ template
|
||||
<typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
move_n(I f, typename std::iterator_traits<I>::difference_type n, F r)
|
||||
move_n(I f, typename boost::container::iterator_traits<I>::difference_type n, F r)
|
||||
{
|
||||
while (n--) {
|
||||
*r = ::boost::move(*f);
|
||||
@ -1002,7 +1003,7 @@ template
|
||||
<typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
move_n(I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
|
||||
move_n(I f, typename boost::container::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
|
||||
{ return container_detail::memmove_n(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -1015,7 +1016,7 @@ template
|
||||
<typename I // I models InputIterator
|
||||
,typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
move_n_source(I f, typename std::iterator_traits<I>::difference_type n, F r)
|
||||
move_n_source(I f, typename boost::container::iterator_traits<I>::difference_type n, F r)
|
||||
{
|
||||
while (n--) {
|
||||
*r = ::boost::move(*f);
|
||||
@ -1028,7 +1029,7 @@ template
|
||||
<typename I // I models InputIterator
|
||||
,typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
move_n_source(I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
|
||||
move_n_source(I f, typename boost::container::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
|
||||
{ return container_detail::memmove_n_source(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -1041,7 +1042,7 @@ template
|
||||
<typename I // I models InputIterator
|
||||
,typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
move_n_source_dest(I f, typename std::iterator_traits<I>::difference_type n, F &r)
|
||||
move_n_source_dest(I f, typename boost::container::iterator_traits<I>::difference_type n, F &r)
|
||||
{
|
||||
while (n--) {
|
||||
*r = ::boost::move(*f);
|
||||
@ -1054,7 +1055,7 @@ template
|
||||
<typename I // I models InputIterator
|
||||
,typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
move_n_source_dest(I f, typename std::iterator_traits<I>::difference_type n, F &r) BOOST_CONTAINER_NOEXCEPT
|
||||
move_n_source_dest(I f, typename boost::container::iterator_traits<I>::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<I, F, I>
|
||||
template
|
||||
<typename A
|
||||
,typename I> // I models InputIterator
|
||||
inline void destroy_alloc_n(A &a, I f, typename std::iterator_traits<I>::difference_type n
|
||||
inline void destroy_alloc_n(A &a, I f, typename boost::container::iterator_traits<I>::difference_type n
|
||||
,typename boost::container::container_detail::enable_if_c
|
||||
< !boost::has_trivial_destructor<typename std::iterator_traits<I>::value_type>::value >::type* = 0)
|
||||
< !boost::has_trivial_destructor<typename boost::container::iterator_traits<I>::value_type>::value >::type* = 0)
|
||||
{
|
||||
while(n--){
|
||||
allocator_traits<A>::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<I>::differe
|
||||
template
|
||||
<typename A
|
||||
,typename I> // I models InputIterator
|
||||
inline void destroy_alloc_n(A &, I, typename std::iterator_traits<I>::difference_type
|
||||
inline void destroy_alloc_n(A &, I, typename boost::container::iterator_traits<I>::difference_type
|
||||
,typename boost::container::container_detail::enable_if_c
|
||||
< boost::has_trivial_destructor<typename std::iterator_traits<I>::value_type>::value >::type* = 0)
|
||||
< boost::has_trivial_destructor<typename boost::container::iterator_traits<I>::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);
|
||||
}
|
||||
|
@ -19,12 +19,11 @@
|
||||
#include <boost/container/detail/workaround.hpp>
|
||||
|
||||
#include <boost/container/container_fwd.hpp>
|
||||
#include <utility>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include <boost/container/detail/flat_tree.hpp>
|
||||
#include <boost/type_traits/has_trivial_destructor.hpp>
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
#include <boost/container/detail/algorithm.hpp> //equal()
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
#include <boost/container/throw_exception.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
@ -32,6 +31,9 @@
|
||||
#include <boost/move/traits.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
|
||||
#include <utility> //pair
|
||||
#include <functional> //less
|
||||
#include <memory> //allocator
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
@ -967,7 +969,7 @@ class flat_map
|
||||
//!
|
||||
//! <b>Complexity</b>: 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()); }
|
||||
|
||||
//! <b>Effects</b>: Returns true if x and y are unequal
|
||||
//!
|
||||
@ -979,7 +981,7 @@ class flat_map
|
||||
//!
|
||||
//! <b>Complexity</b>: 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()); }
|
||||
|
||||
//! <b>Effects</b>: Returns true if x is greater than y
|
||||
//!
|
||||
@ -1868,7 +1870,7 @@ class flat_multimap
|
||||
//!
|
||||
//! <b>Complexity</b>: 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()); }
|
||||
|
||||
//! <b>Effects</b>: Returns true if x and y are unequal
|
||||
//!
|
||||
@ -1880,7 +1882,7 @@ class flat_multimap
|
||||
//!
|
||||
//! <b>Complexity</b>: 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()); }
|
||||
|
||||
//! <b>Effects</b>: Returns true if x is greater than y
|
||||
//!
|
||||
|
@ -19,9 +19,6 @@
|
||||
#include <boost/container/detail/workaround.hpp>
|
||||
|
||||
#include <boost/container/container_fwd.hpp>
|
||||
#include <utility>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <boost/container/detail/flat_tree.hpp>
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
@ -29,9 +26,13 @@
|
||||
#include <boost/move/detail/move_helpers.hpp>
|
||||
#include <boost/move/traits.hpp>
|
||||
|
||||
#include <utility> //pair
|
||||
#include <functional> //less
|
||||
#include <memory> //allocator
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
|
||||
|
@ -20,7 +20,10 @@
|
||||
#include <boost/container/detail/version_type.hpp>
|
||||
#include <boost/container/detail/iterators.hpp>
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
#include <boost/container/detail/algorithm.hpp>
|
||||
#include <boost/container/throw_exception.hpp>
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/iterator.hpp>
|
||||
#include <boost/move/detail/move_helpers.hpp>
|
||||
@ -38,16 +41,11 @@
|
||||
#include <boost/container/detail/preprocessor.hpp>
|
||||
#endif
|
||||
|
||||
#include <memory> //std::allocator
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
|
||||
@ -149,8 +147,8 @@ class list
|
||||
|
||||
BOOST_COPYABLE_AND_MOVABLE(list)
|
||||
|
||||
typedef container_detail::iterator<typename Icont::iterator, false> iterator_impl;
|
||||
typedef container_detail::iterator<typename Icont::iterator, true> const_iterator_impl;
|
||||
typedef container_detail::iterator_from_iiterator<typename Icont::iterator, false> iterator_impl;
|
||||
typedef container_detail::iterator_from_iiterator<typename Icont::iterator, true> 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<iterator>) reverse_iterator;
|
||||
typedef BOOST_CONTAINER_IMPDEF(container_detail::reverse_iterator<const_iterator>) const_reverse_iterator;
|
||||
typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<iterator>) reverse_iterator;
|
||||
typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<const_iterator>) const_reverse_iterator;
|
||||
|
||||
//////////////////////////////////////////////
|
||||
//
|
||||
@ -838,7 +836,7 @@ class list
|
||||
//! <b>Throws</b>: If memory allocation throws, T's constructor from a
|
||||
//! dereferenced InpIt throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to std::distance [first, last).
|
||||
//! <b>Complexity</b>: Linear to distance [first, last).
|
||||
template <class InpIt>
|
||||
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
|
||||
//! <b>Throws</b>: If memory allocation throws, T's constructor from a
|
||||
//! dereferenced std::initializer_list iterator throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to std::distance [il.begin(), il.end()).
|
||||
//! <b>Complexity</b>: Linear to distance [il.begin(), il.end()).
|
||||
iterator insert(const_iterator p, std::initializer_list<value_type> il)
|
||||
{ return insert(p, il.begin(), il.end()); }
|
||||
#endif
|
||||
@ -1065,7 +1063,7 @@ class list
|
||||
|
||||
//! <b>Requires</b>: 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
|
||||
//!
|
||||
//! <b>Effects</b>: 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
|
||||
|
||||
//! <b>Requires</b>: 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
|
||||
//!
|
||||
//! <b>Effects</b>: 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
|
||||
//!
|
||||
//! <b>Complexity</b>: 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()); }
|
||||
|
||||
//! <b>Effects</b>: Returns true if x and y are unequal
|
||||
//!
|
||||
@ -1296,7 +1280,7 @@ class list
|
||||
//!
|
||||
//! <b>Complexity</b>: 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()); }
|
||||
|
||||
//! <b>Effects</b>: Returns true if x is greater than y
|
||||
//!
|
||||
|
@ -19,9 +19,6 @@
|
||||
#include <boost/container/detail/workaround.hpp>
|
||||
|
||||
#include <boost/container/container_fwd.hpp>
|
||||
#include <utility>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <boost/container/detail/tree.hpp>
|
||||
#include <boost/container/detail/value_init.hpp>
|
||||
#include <boost/type_traits/has_trivial_destructor.hpp>
|
||||
@ -37,6 +34,9 @@
|
||||
#include <boost/container/detail/value_init.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
|
||||
#include <utility> //pair
|
||||
#include <functional> //less
|
||||
#include <memory> //allocator
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
|
@ -28,8 +28,7 @@
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/utility/addressof.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
|
@ -19,10 +19,6 @@
|
||||
#include <boost/container/detail/workaround.hpp>
|
||||
#include <boost/container/container_fwd.hpp>
|
||||
|
||||
#include <utility>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/detail/move_helpers.hpp>
|
||||
#include <boost/move/traits.hpp>
|
||||
@ -32,6 +28,10 @@
|
||||
#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
|
||||
#include <boost/container/detail/preprocessor.hpp>
|
||||
#endif
|
||||
|
||||
#include <utility> //pair
|
||||
#include <functional> //less
|
||||
#include <memory> //allocator
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
|
@ -20,19 +20,24 @@
|
||||
|
||||
#include <boost/container/container_fwd.hpp>
|
||||
#include <boost/container/throw_exception.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/detail/move_helpers.hpp>
|
||||
#include <boost/move/traits.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/container/detail/utilities.hpp>
|
||||
#include <boost/container/detail/iterators.hpp>
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
#include <boost/container/detail/type_traits.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
|
||||
#include <boost/container/detail/node_alloc_holder.hpp>
|
||||
#include <boost/container/detail/compare_functors.hpp>
|
||||
#include <boost/container/detail/algorithm.hpp> //algo_equal(), algo_lexicographical_compare
|
||||
|
||||
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/intrusive/slist.hpp>
|
||||
#include <iterator>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/detail/move_helpers.hpp>
|
||||
#include <boost/move/traits.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
|
||||
|
||||
|
||||
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
@ -41,12 +46,7 @@
|
||||
#include <boost/container/detail/preprocessor.hpp>
|
||||
#endif
|
||||
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
|
||||
#include <memory> //std::allocator
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
@ -181,8 +181,8 @@ class slist
|
||||
typedef boost::container::equal_to_value<Allocator> equal_to_value_type;
|
||||
|
||||
BOOST_COPYABLE_AND_MOVABLE(slist)
|
||||
typedef container_detail::iterator<typename Icont::iterator, false> iterator_impl;
|
||||
typedef container_detail::iterator<typename Icont::iterator, true > const_iterator_impl;
|
||||
typedef container_detail::iterator_from_iiterator<typename Icont::iterator, false> iterator_impl;
|
||||
typedef container_detail::iterator_from_iiterator<typename Icont::iterator, true > 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
|
||||
//! <b>Requires</b>: 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.
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1)
|
||||
@ -1082,7 +1082,7 @@ class slist
|
||||
//! <b>Requires</b>: 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.
|
||||
//!
|
||||
//! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1)
|
||||
@ -1349,7 +1349,7 @@ class slist
|
||||
//! <b>Throws</b>: If memory allocation throws, T's constructor from a
|
||||
//! dereferenced InpIt throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to std::distance [first, last) plus
|
||||
//! <b>Complexity</b>: Linear to distance [first, last) plus
|
||||
//! linear to the elements before p.
|
||||
template <class InIter>
|
||||
iterator insert(const_iterator p, InIter first, InIter last)
|
||||
@ -1500,21 +1500,7 @@ class slist
|
||||
//!
|
||||
//! <b>Complexity</b>: 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<T,Allocator>::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()); }
|
||||
|
||||
//! <b>Effects</b>: Returns true if x and y are unequal
|
||||
//!
|
||||
@ -1526,7 +1512,7 @@ class slist
|
||||
//!
|
||||
//! <b>Complexity</b>: 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()); }
|
||||
|
||||
//! <b>Effects</b>: Returns true if x is greater than y
|
||||
//!
|
||||
|
@ -31,8 +31,10 @@
|
||||
#include <boost/container/detail/allocator_version_traits.hpp>
|
||||
#include <boost/container/detail/utilities.hpp>
|
||||
#include <boost/container/detail/iterators.hpp>
|
||||
#include <boost/container/detail/algorithms.hpp>
|
||||
#include <boost/container/detail/construct_in_place.hpp>
|
||||
#include <boost/container/detail/algorithm.hpp> //algo_equal(), algo_lexicographical_compare
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
#include <boost/container/throw_exception.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
@ -41,26 +43,22 @@
|
||||
#include <boost/move/iterator.hpp>
|
||||
#include <boost/move/detail/move_helpers.hpp>
|
||||
#include <boost/container/detail/placement_new.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
#include <utility> //std::pair
|
||||
#include <memory>
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
|
||||
#include <boost/container/vector.hpp>
|
||||
|
||||
//#define STABLE_VECTOR_ENABLE_INVARIANT_CHECKING
|
||||
|
||||
#include <boost/container/vector.hpp>
|
||||
//#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 <initializer_list>
|
||||
#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<iterator>) reverse_iterator;
|
||||
typedef BOOST_CONTAINER_IMPDEF(container_detail::reverse_iterator<const_iterator>) const_reverse_iterator;
|
||||
typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<iterator>) reverse_iterator;
|
||||
typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<const_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));
|
||||
}
|
||||
|
||||
//! <b>Effects</b>: Returns the largest possible size of the stable_vector.
|
||||
@ -1462,7 +1460,7 @@ class stable_vector
|
||||
//!
|
||||
//! <b>Returns</b>: an iterator to the first inserted element or p if first == last.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to std::distance [il.begin(), il.end()).
|
||||
//! <b>Complexity</b>: Linear to distance [il.begin(), il.end()).
|
||||
iterator insert(const_iterator p, std::initializer_list<value_type> il)
|
||||
{
|
||||
STABLE_VECTOR_CHECK_INVARIANT;
|
||||
@ -1479,7 +1477,7 @@ class stable_vector
|
||||
//! <b>Throws</b>: If memory allocation throws, T's constructor from a
|
||||
//! dereferenced InpIt throws or T's copy constructor throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to std::distance [first, last).
|
||||
//! <b>Complexity</b>: Linear to distance [first, last).
|
||||
template <class InputIterator>
|
||||
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<size_type>(std::distance(first, last));
|
||||
const size_type num_new = static_cast<size_type>(boost::container::iterator_distance(first, last));
|
||||
const size_type idx = static_cast<size_type>(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
|
||||
//!
|
||||
//! <b>Complexity</b>: 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()); }
|
||||
|
||||
//! <b>Effects</b>: Returns true if x and y are unequal
|
||||
//!
|
||||
@ -1635,7 +1633,7 @@ class stable_vector
|
||||
//!
|
||||
//! <b>Complexity</b>: 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()); }
|
||||
|
||||
//! <b>Effects</b>: Returns true if x is greater than y
|
||||
//!
|
||||
|
@ -20,6 +20,11 @@
|
||||
#include <boost/container/vector.hpp>
|
||||
#include <boost/aligned_storage.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace container {
|
||||
|
||||
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
|
||||
|
@ -28,18 +28,18 @@
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
#include <boost/container/detail/allocator_version_traits.hpp>
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
#include <iosfwd>
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
@ -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<iterator>) reverse_iterator;
|
||||
typedef BOOST_CONTAINER_IMPDEF(container_detail::reverse_iterator<const_iterator>) const_reverse_iterator;
|
||||
typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<iterator>) reverse_iterator;
|
||||
typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<const_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<CharT*>(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<CharT*>(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<InputIter>::iterator_category Category;
|
||||
typedef typename boost::container::iterator_traits<InputIter>::iterator_category Category;
|
||||
return this->priv_replace(first, last, f, l, Category());
|
||||
}
|
||||
|
||||
|
@ -19,14 +19,6 @@
|
||||
#include <boost/container/detail/workaround.hpp>
|
||||
#include <boost/container/container_fwd.hpp>
|
||||
|
||||
//#include <cstddef> //Already included by container_fwd.hpp
|
||||
#include <memory> //for std::allocator
|
||||
#include <iterator> //for std::random_access_iterator_tag
|
||||
#include <utility> //for std::pair,std::distance
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
#include <initializer_list> //for std::initializer_list
|
||||
#endif
|
||||
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
@ -46,6 +38,8 @@
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
#include <boost/container/detail/type_traits.hpp>
|
||||
#include <boost/container/detail/advanced_insert_int.hpp>
|
||||
#include <boost/container/detail/algorithm.hpp> //equal()
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
|
||||
@ -56,6 +50,12 @@
|
||||
#include <boost/type_traits/has_nothrow_assign.hpp>
|
||||
#include <boost/type_traits/has_nothrow_constructor.hpp>
|
||||
|
||||
#include <memory> //for std::allocator
|
||||
#include <utility> //for std::pair
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
#include <initializer_list> //for std::initializer_list
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
|
||||
@ -505,7 +505,7 @@ struct vector_alloc_holder<Allocator, container_detail::integral_constant<unsign
|
||||
template<class OtherAllocator, class OtherAllocatorVersion>
|
||||
void priv_swap_members_impl(vector_alloc_holder<OtherAllocator, OtherAllocatorVersion> &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<iterator>) reverse_iterator;
|
||||
typedef BOOST_CONTAINER_IMPDEF(container_detail::reverse_iterator<const_iterator>) const_reverse_iterator;
|
||||
typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<iterator>) reverse_iterator;
|
||||
typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<const_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<size_type>(std::distance(first, last));
|
||||
const size_type input_sz = static_cast<size_type>(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
|
||||
//! <b>Throws</b>: If memory allocation throws, T's constructor from a
|
||||
//! dereferenced InpIt throws or T's copy/move constructor/assignment throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to std::distance [first, last).
|
||||
//! <b>Complexity</b>: Linear to boost::container::iterator_distance [first, last).
|
||||
template <class InIt>
|
||||
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<Allocator, FwdIt, T*> 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
|
||||
|
||||
//! <b>Requires</b>: 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)
|
||||
//!
|
||||
//! <b>Effects</b>: Insert a copy of the [first, last) range before pos.
|
||||
//!
|
||||
@ -1650,9 +1650,9 @@ class vector
|
||||
//! <b>Throws</b>: If memory allocation throws, T's constructor from a
|
||||
//! dereferenced InpIt throws or T's copy/move constructor/assignment throws.
|
||||
//!
|
||||
//! <b>Complexity</b>: Linear to std::distance [first, last).
|
||||
//! <b>Complexity</b>: Linear to boost::container::iterator_distance [first, last).
|
||||
//!
|
||||
//! <b>Note</b>: This function avoids a linear operation to calculate std::distance[first, last)
|
||||
//! <b>Note</b>: 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<InIt>::value ||
|
||||
num == static_cast<size_type>(std::distance(first, last)));
|
||||
num == static_cast<size_type>(boost::container::iterator_distance(first, last)));
|
||||
(void)last;
|
||||
container_detail::insert_range_proxy<Allocator, InIt, T*> proxy(first);
|
||||
return this->priv_forward_range_insert(vector_iterator_get_ptr(pos), num, proxy, alloc_version());
|
||||
@ -1772,21 +1772,7 @@ class vector
|
||||
//!
|
||||
//! <b>Complexity</b>: 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()); }
|
||||
|
||||
//! <b>Effects</b>: 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<size_type>(*(--last_position_it));
|
||||
BOOST_ASSERT(pos <= old_size_pos);
|
||||
|
@ -174,7 +174,7 @@
|
||||
RelativePath="..\..\..\..\boost\container\detail\advanced_insert_int.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\boost\container\detail\algorithms.hpp">
|
||||
RelativePath="..\..\..\..\boost\container\detail\algorithm.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\boost\container\detail\alloc_lib.h">
|
||||
@ -200,6 +200,9 @@
|
||||
<File
|
||||
RelativePath="..\..\..\..\boost\container\detail\config_end.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\boost\container\detail\construct_in_place.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\test\container_common_tests.hpp">
|
||||
</File>
|
||||
@ -216,7 +219,7 @@
|
||||
RelativePath="..\..\..\..\boost\container\detail\hash_table.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\boost\container\detail\iterator_traits.hpp">
|
||||
RelativePath="..\..\..\..\boost\container\detail\iterator.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\boost\container\detail\iterators.hpp">
|
||||
@ -257,15 +260,15 @@
|
||||
<File
|
||||
RelativePath="..\..\..\..\boost\container\detail\preprocessor.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\boost\container\detail\reverse_iterator.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\boost\container\detail\singleton.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\boost\container\detail\std_fwd.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\boost\container\detail\swap.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\boost\container\detail\transform_iterator.hpp">
|
||||
</File>
|
||||
|
@ -14,11 +14,11 @@
|
||||
#include <boost/container/detail/config_begin.hpp>
|
||||
#include <boost/container/detail/pair.hpp>
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <boost/move/unique_ptr.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -14,8 +14,9 @@
|
||||
#include <boost/container/detail/config_begin.hpp>
|
||||
#include <vector>
|
||||
#include <typeinfo>
|
||||
#include <iostream>
|
||||
#include "expand_bwd_test_allocator.hpp"
|
||||
#include <algorithm>
|
||||
#include <boost/container/detail/algorithm.hpp> //equal()
|
||||
#include "movable_int.hpp"
|
||||
#include <boost/type_traits/remove_volatile.hpp>
|
||||
#include <boost/move/make_unique.hpp>
|
||||
@ -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<class Vector>
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <boost/container/allocator.hpp>
|
||||
#include <boost/container/node_allocator.hpp>
|
||||
#include <boost/container/adaptive_pool.hpp>
|
||||
#include <boost/container/detail/flat_tree.hpp>
|
||||
|
||||
#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 <vector>
|
||||
#include <boost/container/detail/flat_tree.hpp>
|
||||
#include <map>
|
||||
|
||||
|
||||
using namespace boost::container;
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#ifndef BOOST_CONTAINER_TEST_FORWARD_TO_INPUT_ITERATOR_HPP
|
||||
#define BOOST_CONTAINER_TEST_FORWARD_TO_INPUT_ITERATOR_HPP
|
||||
|
||||
#include <iterator>
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
|
||||
namespace boost{
|
||||
namespace container {
|
||||
@ -19,11 +19,11 @@ namespace test{
|
||||
|
||||
template<class FwdIterator>
|
||||
class input_iterator_wrapper
|
||||
: public std::iterator< std::input_iterator_tag
|
||||
, typename std::iterator_traits<FwdIterator>::value_type
|
||||
, typename std::iterator_traits<FwdIterator>::difference_type
|
||||
, typename std::iterator_traits<FwdIterator>::pointer
|
||||
, typename std::iterator_traits<FwdIterator>::reference
|
||||
: public boost::container::iterator< std::input_iterator_tag
|
||||
, typename boost::container::iterator_traits<FwdIterator>::value_type
|
||||
, typename boost::container::iterator_traits<FwdIterator>::difference_type
|
||||
, typename boost::container::iterator_traits<FwdIterator>::pointer
|
||||
, typename boost::container::iterator_traits<FwdIterator>::reference
|
||||
>
|
||||
{
|
||||
FwdIterator m_it;
|
||||
@ -46,10 +46,10 @@ class input_iterator_wrapper
|
||||
//Default destructor...
|
||||
//~input_iterator_wrapper();
|
||||
|
||||
typename std::iterator_traits<FwdIterator>::reference operator*() const
|
||||
typename boost::container::iterator_traits<FwdIterator>::reference operator*() const
|
||||
{ return *m_it; }
|
||||
|
||||
typename std::iterator_traits<FwdIterator>::pointer operator->() const
|
||||
typename boost::container::iterator_traits<FwdIterator>::pointer operator->() const
|
||||
{ return m_it.operator->(); }
|
||||
|
||||
input_iterator_wrapper& operator++()
|
||||
|
@ -53,9 +53,9 @@ template class boost::container::list
|
||||
|
||||
namespace container_detail {
|
||||
|
||||
template class iterator
|
||||
template class iterator_from_iiterator
|
||||
<intrusive_list_type< std::allocator<int> >::container_type::iterator, true >;
|
||||
template class iterator
|
||||
template class iterator_from_iiterator
|
||||
<intrusive_list_type< std::allocator<int> >::container_type::iterator, false>;
|
||||
|
||||
}
|
||||
|
@ -12,18 +12,20 @@
|
||||
#define BOOST_CONTAINER_TEST_LIST_TEST_HEADER
|
||||
|
||||
#include <boost/container/detail/config_begin.hpp>
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
#include "check_equal_containers.hpp"
|
||||
#include <memory>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include "print_container.hpp"
|
||||
#include "input_from_forward_iterator.hpp"
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/iterator.hpp>
|
||||
#include <string>
|
||||
#include <boost/move/make_unique.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <functional> //std::greater
|
||||
#include <string>
|
||||
|
||||
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))
|
||||
|
@ -12,7 +12,9 @@
|
||||
#include <boost/container/allocator.hpp>
|
||||
#include <boost/container/node_allocator.hpp>
|
||||
#include <boost/container/adaptive_pool.hpp>
|
||||
|
||||
#include <utility>
|
||||
#include <map>
|
||||
|
||||
#include "print_container.hpp"
|
||||
#include "movable_int.hpp"
|
||||
|
@ -13,16 +13,16 @@
|
||||
|
||||
#include <boost/container/detail/config_begin.hpp>
|
||||
#include "check_equal_containers.hpp"
|
||||
#include <map>
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
#include "print_container.hpp"
|
||||
#include <boost/container/detail/utilities.hpp>
|
||||
#include <boost/container/detail/pair.hpp>
|
||||
#include <boost/move/iterator.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/make_unique.hpp>
|
||||
|
||||
#include <utility> //std::pair
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
|
||||
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME rebalance
|
||||
@ -506,8 +506,8 @@ int map_test()
|
||||
std::pair<typename MyStdMultiMap::iterator, typename MyStdMultiMap::iterator> 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;
|
||||
}
|
||||
}
|
||||
|
@ -10,13 +10,13 @@
|
||||
#include <boost/container/detail/config_begin.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/container/vector.hpp>
|
||||
#include <boost/container/stable_vector.hpp>
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
#include <boost/container/vector.hpp>
|
||||
#include <boost/container/stable_vector.hpp>
|
||||
|
||||
#include "static_vector_test.hpp"
|
||||
|
||||
namespace boost {
|
||||
@ -208,7 +208,7 @@ void test_pop_back_nd()
|
||||
template <typename It1, typename It2>
|
||||
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<T, N> s1(s);
|
||||
|
||||
typename C::const_iterator it = c.begin();
|
||||
std::advance(it, n);
|
||||
boost::container::iterator_advance(it, n);
|
||||
typename static_vector<T, N>::iterator
|
||||
it1 = s1.insert(s1.begin() + i, c.begin(), it);
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <boost/container/string.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <boost/container/detail/algorithm.hpp> //equal()
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <cstddef>
|
||||
@ -68,7 +68,7 @@ template<class StrVector1, class StrVector2>
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#define BOOST_CONTAINER_TEST_VECTOR_TEST_HEADER
|
||||
|
||||
#include <boost/container/detail/config_begin.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
@ -21,21 +21,25 @@
|
||||
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
#include "print_container.hpp"
|
||||
#include "check_equal_containers.hpp"
|
||||
#include "movable_int.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "emplace_test.hpp"
|
||||
#include "input_from_forward_iterator.hpp"
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/move/iterator.hpp>
|
||||
#include <boost/move/make_unique.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#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 <cstddef>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
Reference in New Issue
Block a user