update boost on linux
This commit is contained in:
@@ -37,18 +37,7 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
|
||||
template<bool AlignOnly>
|
||||
struct select_private_adaptive_node_pool_impl
|
||||
{
|
||||
typedef boost::container::container_detail::
|
||||
private_adaptive_node_pool_impl
|
||||
< fake_segment_manager
|
||||
, unsigned(AlignOnly)*::boost::container::adaptive_pool_flag::align_only
|
||||
| ::boost::container::adaptive_pool_flag::size_ordered | ::boost::container::adaptive_pool_flag::address_ordered
|
||||
> type;
|
||||
};
|
||||
namespace dtl {
|
||||
|
||||
//!Pooled memory allocator using an smart adaptive pool. Includes
|
||||
//!a reference count but the class does not delete itself, this is
|
||||
@@ -60,24 +49,38 @@ template< std::size_t NodeSize
|
||||
, std::size_t OverheadPercent
|
||||
>
|
||||
class private_adaptive_node_pool
|
||||
: public select_private_adaptive_node_pool_impl<(OverheadPercent == 0)>::type
|
||||
: public private_adaptive_node_pool_impl_ct
|
||||
< fake_segment_manager
|
||||
, MaxFreeBlocks
|
||||
, NodeSize
|
||||
, NodesPerBlock
|
||||
, OverheadPercent
|
||||
, unsigned(OverheadPercent == 0)*::boost::container::adaptive_pool_flag::align_only
|
||||
| ::boost::container::adaptive_pool_flag::size_ordered
|
||||
| ::boost::container::adaptive_pool_flag::address_ordered
|
||||
>
|
||||
{
|
||||
typedef typename select_private_adaptive_node_pool_impl<OverheadPercent == 0>::type base_t;
|
||||
typedef private_adaptive_node_pool_impl_ct
|
||||
< fake_segment_manager
|
||||
, MaxFreeBlocks
|
||||
, NodeSize
|
||||
, NodesPerBlock
|
||||
, OverheadPercent
|
||||
, unsigned(OverheadPercent == 0)*::boost::container::adaptive_pool_flag::align_only
|
||||
| ::boost::container::adaptive_pool_flag::size_ordered
|
||||
| ::boost::container::adaptive_pool_flag::address_ordered
|
||||
> base_t;
|
||||
|
||||
//Non-copyable
|
||||
private_adaptive_node_pool(const private_adaptive_node_pool &);
|
||||
private_adaptive_node_pool &operator=(const private_adaptive_node_pool &);
|
||||
|
||||
public:
|
||||
typedef typename base_t::multiallocation_chain multiallocation_chain;
|
||||
static const std::size_t nodes_per_block = NodesPerBlock;
|
||||
|
||||
//!Constructor. Never throws
|
||||
private_adaptive_node_pool()
|
||||
: base_t(0
|
||||
, NodeSize
|
||||
, NodesPerBlock
|
||||
, MaxFreeBlocks
|
||||
, (unsigned char)OverheadPercent)
|
||||
: base_t(0)
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -157,7 +160,7 @@ class shared_adaptive_node_pool
|
||||
default_mutex mutex_;
|
||||
};
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,7 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
template <typename T>
|
||||
BOOST_CONTAINER_FORCEINLINE T* addressof(T& obj)
|
||||
@@ -34,7 +34,7 @@ BOOST_CONTAINER_FORCEINLINE T* addressof(T& obj)
|
||||
)));
|
||||
}
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <boost/container/detail/type_traits.hpp>
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
#include <boost/container/detail/iterators.hpp>
|
||||
#include <boost/container/detail/iterator_to_raw_pointer.hpp>
|
||||
#include <boost/move/detail/iterator_to_raw_pointer.hpp>
|
||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
#include <boost/move/detail/fwd_macros.hpp>
|
||||
#endif
|
||||
@@ -41,7 +41,7 @@
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
|
||||
namespace boost { namespace container { namespace container_detail {
|
||||
namespace boost { namespace container { namespace dtl {
|
||||
|
||||
template<class Allocator, class FwdIt, class Iterator>
|
||||
struct move_insert_range_proxy
|
||||
@@ -125,8 +125,16 @@ struct insert_value_initialized_n_proxy
|
||||
void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const
|
||||
{ boost::container::uninitialized_value_init_alloc_n(a, n, p); }
|
||||
|
||||
void copy_n_and_update(Allocator &, Iterator, size_type) const
|
||||
{ BOOST_ASSERT(false); }
|
||||
void copy_n_and_update(Allocator &a, Iterator p, size_type n) const
|
||||
{
|
||||
for (; 0 < n; --n, ++p){
|
||||
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;
|
||||
value_type *vp = reinterpret_cast<value_type *>(v.data);
|
||||
alloc_traits::construct(a, vp);
|
||||
value_destructor<Allocator> on_exit(a, *vp); (void)on_exit;
|
||||
*p = ::boost::move(*vp);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<class Allocator, class Iterator>
|
||||
@@ -139,8 +147,18 @@ struct insert_default_initialized_n_proxy
|
||||
void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const
|
||||
{ boost::container::uninitialized_default_init_alloc_n(a, n, p); }
|
||||
|
||||
void copy_n_and_update(Allocator &, Iterator, size_type) const
|
||||
{ BOOST_ASSERT(false); }
|
||||
void copy_n_and_update(Allocator &a, Iterator p, size_type n) const
|
||||
{
|
||||
if(!is_pod<value_type>::value){
|
||||
for (; 0 < n; --n, ++p){
|
||||
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;
|
||||
value_type *vp = reinterpret_cast<value_type *>(v.data);
|
||||
alloc_traits::construct(a, vp, default_init);
|
||||
value_destructor<Allocator> on_exit(a, *vp); (void)on_exit;
|
||||
*p = ::boost::move(*vp);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<class Allocator, class Iterator>
|
||||
@@ -157,13 +175,13 @@ struct insert_copy_proxy
|
||||
void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const
|
||||
{
|
||||
BOOST_ASSERT(n == 1); (void)n;
|
||||
alloc_traits::construct( a, iterator_to_raw_pointer(p), v_);
|
||||
alloc_traits::construct( a, boost::movelib::iterator_to_raw_pointer(p), v_);
|
||||
}
|
||||
|
||||
void copy_n_and_update(Allocator &, Iterator p, size_type n) const
|
||||
{
|
||||
BOOST_ASSERT(n == 1); (void)n;
|
||||
*p =v_;
|
||||
*p = v_;
|
||||
}
|
||||
|
||||
const value_type &v_;
|
||||
@@ -184,7 +202,7 @@ struct insert_move_proxy
|
||||
void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const
|
||||
{
|
||||
BOOST_ASSERT(n == 1); (void)n;
|
||||
alloc_traits::construct( a, iterator_to_raw_pointer(p), ::boost::move(v_) );
|
||||
alloc_traits::construct( a, boost::movelib::iterator_to_raw_pointer(p), ::boost::move(v_) );
|
||||
}
|
||||
|
||||
void copy_n_and_update(Allocator &, Iterator p, size_type n) const
|
||||
@@ -208,7 +226,7 @@ insert_copy_proxy<Allocator, It> get_insert_value_proxy(const typename boost::co
|
||||
return insert_copy_proxy<Allocator, It>(v);
|
||||
}
|
||||
|
||||
}}} //namespace boost { namespace container { namespace container_detail {
|
||||
}}} //namespace boost { namespace container { namespace dtl {
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
@@ -217,7 +235,7 @@ insert_copy_proxy<Allocator, It> get_insert_value_proxy(const typename boost::co
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
template<class Allocator, class Iterator, class ...Args>
|
||||
struct insert_nonmovable_emplace_proxy
|
||||
@@ -240,7 +258,7 @@ struct insert_nonmovable_emplace_proxy
|
||||
void priv_uninitialized_copy_some_and_update(Allocator &a, const index_tuple<IdxPack...>&, Iterator p, size_type n)
|
||||
{
|
||||
BOOST_ASSERT(n == 1); (void)n;
|
||||
alloc_traits::construct( a, iterator_to_raw_pointer(p), ::boost::forward<Args>(get<IdxPack>(this->args_))... );
|
||||
alloc_traits::construct( a, boost::movelib::iterator_to_raw_pointer(p), ::boost::forward<Args>(get<IdxPack>(this->args_))... );
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -271,7 +289,7 @@ struct insert_emplace_proxy
|
||||
{
|
||||
BOOST_ASSERT(n ==1); (void)n;
|
||||
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;
|
||||
value_type *vp = static_cast<value_type *>(static_cast<void *>(&v));
|
||||
value_type *vp = reinterpret_cast<value_type *>(v.data);
|
||||
alloc_traits::construct(a, vp,
|
||||
::boost::forward<Args>(get<IdxPack>(this->args_))...);
|
||||
BOOST_TRY{
|
||||
@@ -301,7 +319,7 @@ struct insert_emplace_proxy<Allocator, Iterator, typename boost::container::allo
|
||||
//Any problem is solvable with an extra layer of indirection? ;-)
|
||||
template<class Allocator, class Iterator>
|
||||
struct insert_emplace_proxy<Allocator, Iterator
|
||||
, typename boost::container::container_detail::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type
|
||||
, typename boost::container::dtl::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type
|
||||
>
|
||||
: public insert_copy_proxy<Allocator, Iterator>
|
||||
{
|
||||
@@ -321,7 +339,7 @@ struct insert_emplace_proxy<Allocator, Iterator, typename boost::container::allo
|
||||
|
||||
template<class Allocator, class Iterator>
|
||||
struct insert_emplace_proxy<Allocator, Iterator
|
||||
, typename boost::container::container_detail::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type &
|
||||
, typename boost::container::dtl::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type &
|
||||
>
|
||||
: public insert_copy_proxy<Allocator, Iterator>
|
||||
{
|
||||
@@ -330,7 +348,7 @@ struct insert_emplace_proxy<Allocator, Iterator
|
||||
{}
|
||||
};
|
||||
|
||||
}}} //namespace boost { namespace container { namespace container_detail {
|
||||
}}} //namespace boost { namespace container { namespace dtl {
|
||||
|
||||
#else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
@@ -338,7 +356,7 @@ struct insert_emplace_proxy<Allocator, Iterator
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
#define BOOST_CONTAINER_ADVANCED_INSERT_INT_CODE(N) \
|
||||
template< class Allocator, class Iterator BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
|
||||
@@ -354,7 +372,7 @@ struct insert_nonmovable_emplace_proxy##N\
|
||||
void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n)\
|
||||
{\
|
||||
BOOST_ASSERT(n == 1); (void)n;\
|
||||
alloc_traits::construct(a, iterator_to_raw_pointer(p) BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\
|
||||
alloc_traits::construct(a, boost::movelib::iterator_to_raw_pointer(p) BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\
|
||||
}\
|
||||
\
|
||||
void copy_n_and_update(Allocator &, Iterator, size_type)\
|
||||
@@ -382,7 +400,7 @@ struct insert_emplace_proxy_arg##N\
|
||||
BOOST_ASSERT(n == 1); (void)n;\
|
||||
typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;\
|
||||
BOOST_ASSERT((((size_type)(&v)) % alignment_of<value_type>::value) == 0);\
|
||||
value_type *vp = static_cast<value_type *>(static_cast<void *>(&v));\
|
||||
value_type *vp = reinterpret_cast<value_type *>(v.data);\
|
||||
alloc_traits::construct(a, vp BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\
|
||||
BOOST_TRY{\
|
||||
*p = ::boost::move(*vp);\
|
||||
@@ -437,7 +455,7 @@ struct insert_emplace_proxy_arg1<Allocator, Iterator, typename boost::container:
|
||||
//Any problem is solvable with an extra layer of indirection? ;-)
|
||||
template<class Allocator, class Iterator>
|
||||
struct insert_emplace_proxy_arg1<Allocator, Iterator
|
||||
, typename boost::container::container_detail::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type
|
||||
, typename boost::container::dtl::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type
|
||||
>
|
||||
: public insert_copy_proxy<Allocator, Iterator>
|
||||
{
|
||||
@@ -457,7 +475,7 @@ struct insert_emplace_proxy_arg1<Allocator, Iterator, typename boost::container:
|
||||
|
||||
template<class Allocator, class Iterator>
|
||||
struct insert_emplace_proxy_arg1<Allocator, Iterator
|
||||
, typename boost::container::container_detail::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type &
|
||||
, typename boost::container::dtl::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type &
|
||||
>
|
||||
: public insert_copy_proxy<Allocator, Iterator>
|
||||
{
|
||||
@@ -468,7 +486,7 @@ struct insert_emplace_proxy_arg1<Allocator, Iterator
|
||||
|
||||
#endif
|
||||
|
||||
}}} //namespace boost { namespace container { namespace container_detail {
|
||||
}}} //namespace boost { namespace container { namespace dtl {
|
||||
|
||||
#endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
|
||||
@@ -29,6 +29,128 @@ namespace container {
|
||||
using boost::intrusive::algo_equal;
|
||||
using boost::intrusive::algo_lexicographical_compare;
|
||||
|
||||
template<class Func>
|
||||
class binder1st
|
||||
{
|
||||
public:
|
||||
typedef typename Func::second_argument_type argument_type;
|
||||
typedef typename Func::result_type result_type;
|
||||
|
||||
binder1st(const Func& func, const typename Func::first_argument_type& arg)
|
||||
: op(func), value(arg)
|
||||
{}
|
||||
|
||||
result_type operator()(const argument_type& arg) const
|
||||
{ return op(value, arg); }
|
||||
|
||||
result_type operator()(argument_type& arg) const
|
||||
{ return op(value, arg); }
|
||||
|
||||
private:
|
||||
Func op;
|
||||
typename Func::first_argument_type value;
|
||||
};
|
||||
|
||||
template<class Func, class T>
|
||||
inline binder1st<Func> bind1st(const Func& func, const T& arg)
|
||||
{ return boost::container::binder1st<Func>(func, arg); }
|
||||
|
||||
template<class Func>
|
||||
class binder2nd
|
||||
{
|
||||
public:
|
||||
typedef typename Func::first_argument_type argument_type;
|
||||
typedef typename Func::result_type result_type;
|
||||
|
||||
binder2nd(const Func& func, const typename Func::second_argument_type& arg)
|
||||
: op(func), value(arg)
|
||||
{}
|
||||
|
||||
result_type operator()(const argument_type& arg) const
|
||||
{ return op(arg, value); }
|
||||
|
||||
result_type operator()(argument_type& arg) const
|
||||
{ return op(arg, value); }
|
||||
|
||||
private:
|
||||
Func op;
|
||||
typename Func::second_argument_type value;
|
||||
};
|
||||
|
||||
template<class Func, class T>
|
||||
inline binder2nd<Func> bind2nd(const Func& func, const T& arg)
|
||||
{
|
||||
return (boost::container::binder2nd<Func>(func, arg));
|
||||
}
|
||||
|
||||
template<class Func>
|
||||
class unary_negate
|
||||
{
|
||||
public:
|
||||
typedef typename Func::argument_type argument_type;
|
||||
typedef typename Func::result_type result_type;
|
||||
|
||||
explicit unary_negate(const Func& func)
|
||||
: m_func(func)
|
||||
{}
|
||||
|
||||
bool operator()(const typename Func::argument_type& arg) const
|
||||
{ return !m_func(arg); }
|
||||
|
||||
private:
|
||||
Func m_func;
|
||||
};
|
||||
|
||||
template<class Func> inline
|
||||
unary_negate<Func> not1(const Func& func)
|
||||
{
|
||||
return boost::container::unary_negate<Func>(func);
|
||||
}
|
||||
|
||||
template<class InputIt, class UnaryPredicate>
|
||||
InputIt find_if(InputIt first, InputIt last, UnaryPredicate p)
|
||||
{
|
||||
for (; first != last; ++first) {
|
||||
if (p(*first)) {
|
||||
return first;
|
||||
}
|
||||
}
|
||||
return last;
|
||||
}
|
||||
|
||||
template<class InputIt, class ForwardIt, class BinaryPredicate>
|
||||
InputIt find_first_of(InputIt first1, InputIt last1, ForwardIt first2, ForwardIt last2, BinaryPredicate p)
|
||||
{
|
||||
for (; first1 != last1; ++first1) {
|
||||
for (ForwardIt it = first2; it != last2; ++it) {
|
||||
if (p(*first1, *it)) {
|
||||
return first1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return last1;
|
||||
}
|
||||
|
||||
template<class ForwardIt1, class ForwardIt2, class BinaryPredicate>
|
||||
ForwardIt1 search(ForwardIt1 first1, ForwardIt1 last1,
|
||||
ForwardIt2 first2, ForwardIt2 last2, BinaryPredicate p)
|
||||
{
|
||||
for (; ; ++first1) {
|
||||
ForwardIt1 it = first1;
|
||||
for (ForwardIt2 it2 = first2; ; ++it, ++it2) {
|
||||
if (it2 == last2) {
|
||||
return first1;
|
||||
}
|
||||
if (it == last1) {
|
||||
return last1;
|
||||
}
|
||||
if (!p(*it, *it2)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -24,36 +24,36 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
template<class AllocatorType>
|
||||
inline void swap_alloc(AllocatorType &, AllocatorType &, container_detail::false_type)
|
||||
inline void swap_alloc(AllocatorType &, AllocatorType &, dtl::false_type)
|
||||
BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{}
|
||||
|
||||
template<class AllocatorType>
|
||||
inline void swap_alloc(AllocatorType &l, AllocatorType &r, container_detail::true_type)
|
||||
inline void swap_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type)
|
||||
{ boost::adl_move_swap(l, r); }
|
||||
|
||||
template<class AllocatorType>
|
||||
inline void assign_alloc(AllocatorType &, const AllocatorType &, container_detail::false_type)
|
||||
inline void assign_alloc(AllocatorType &, const AllocatorType &, dtl::false_type)
|
||||
BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{}
|
||||
|
||||
template<class AllocatorType>
|
||||
inline void assign_alloc(AllocatorType &l, const AllocatorType &r, container_detail::true_type)
|
||||
inline void assign_alloc(AllocatorType &l, const AllocatorType &r, dtl::true_type)
|
||||
{ l = r; }
|
||||
|
||||
template<class AllocatorType>
|
||||
inline void move_alloc(AllocatorType &, AllocatorType &, container_detail::false_type)
|
||||
inline void move_alloc(AllocatorType &, AllocatorType &, dtl::false_type)
|
||||
BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{}
|
||||
|
||||
template<class AllocatorType>
|
||||
inline void move_alloc(AllocatorType &l, AllocatorType &r, container_detail::true_type)
|
||||
inline void move_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type)
|
||||
{ l = ::boost::move(r); }
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -33,12 +33,12 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
template<class Allocator, unsigned Version = boost::container::container_detail::version<Allocator>::value>
|
||||
template<class Allocator, unsigned Version = boost::container::dtl::version<Allocator>::value>
|
||||
struct allocator_version_traits
|
||||
{
|
||||
typedef ::boost::container::container_detail::integral_constant
|
||||
typedef ::boost::container::dtl::integral_constant
|
||||
<unsigned, Version> alloc_version;
|
||||
|
||||
typedef typename Allocator::multiallocation_chain multiallocation_chain;
|
||||
@@ -67,7 +67,7 @@ struct allocator_version_traits
|
||||
template<class Allocator>
|
||||
struct allocator_version_traits<Allocator, 1>
|
||||
{
|
||||
typedef ::boost::container::container_detail::integral_constant
|
||||
typedef ::boost::container::dtl::integral_constant
|
||||
<unsigned, 1> alloc_version;
|
||||
|
||||
typedef typename boost::container::allocator_traits<Allocator>::pointer pointer;
|
||||
@@ -76,9 +76,9 @@ struct allocator_version_traits<Allocator, 1>
|
||||
|
||||
typedef typename boost::intrusive::pointer_traits<pointer>::
|
||||
template rebind_pointer<void>::type void_ptr;
|
||||
typedef container_detail::basic_multiallocation_chain
|
||||
typedef dtl::basic_multiallocation_chain
|
||||
<void_ptr> multialloc_cached_counted;
|
||||
typedef boost::container::container_detail::
|
||||
typedef boost::container::dtl::
|
||||
transform_multiallocation_chain
|
||||
< multialloc_cached_counted, value_type> multiallocation_chain;
|
||||
|
||||
@@ -93,7 +93,8 @@ struct allocator_version_traits<Allocator, 1>
|
||||
{
|
||||
size_type n = holder.size();
|
||||
typename multiallocation_chain::iterator it = holder.begin();
|
||||
while(n--){
|
||||
while(n){
|
||||
--n;
|
||||
pointer p = boost::intrusive::pointer_traits<pointer>::pointer_to(*it);
|
||||
++it;
|
||||
a.deallocate(p, 1);
|
||||
@@ -153,7 +154,7 @@ struct allocator_version_traits<Allocator, 1>
|
||||
}
|
||||
};
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <boost/intrusive/circular_list_algorithms.hpp>
|
||||
#include <boost/move/detail/type_traits.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/container/detail/placement_new.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
@@ -100,7 +101,7 @@ class block_list_base
|
||||
if((size_t(-1) - header_size) < size)
|
||||
throw_bad_alloc();
|
||||
void *p = mr.allocate(size+header_size);
|
||||
block_list_header &mb = *::new((void*)p) DerivedFromBlockListHeader;
|
||||
block_list_header &mb = *::new((void*)p, boost_container_new_t()) DerivedFromBlockListHeader;
|
||||
mb.size = size+header_size;
|
||||
list_algo::link_after(&m_list, &mb);
|
||||
return (char *)p + header_size;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <boost/container/container_fwd.hpp>
|
||||
#include <boost/container/pmr/memory_resource.hpp>
|
||||
#include <boost/container/throw_exception.hpp>
|
||||
#include <boost/container/detail/placement_new.hpp>
|
||||
|
||||
#include <boost/move/detail/type_traits.hpp>
|
||||
#include <boost/intrusive/linear_slist_algorithms.hpp>
|
||||
@@ -94,7 +95,7 @@ class block_slist_base
|
||||
if((size_t(-1) - header_size) < size)
|
||||
throw_bad_alloc();
|
||||
void *p = mr.allocate(size+header_size);
|
||||
block_slist_header &mb = *::new((void*)p) DerivedFromBlockSlistHeader;
|
||||
block_slist_header &mb = *::new((void*)p, boost_container_new_t()) DerivedFromBlockSlistHeader;
|
||||
mb.size = size+header_size;
|
||||
slist_algo::link_after(&m_slist, &mb);
|
||||
return (char *)p + header_size;
|
||||
|
||||
@@ -19,13 +19,15 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/intrusive/detail/ebo_functor_holder.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
|
||||
template<class Allocator>
|
||||
template<class ValueType>
|
||||
class equal_to_value
|
||||
{
|
||||
typedef typename Allocator::value_type value_type;
|
||||
typedef ValueType value_type;
|
||||
const value_type &t_;
|
||||
|
||||
public:
|
||||
@@ -37,7 +39,7 @@ class equal_to_value
|
||||
{ return t_ == t; }
|
||||
};
|
||||
|
||||
template<class Node, class Pred>
|
||||
template<class Node, class Pred, class Ret = bool>
|
||||
struct value_to_node_compare
|
||||
: Pred
|
||||
{
|
||||
@@ -52,22 +54,76 @@ struct value_to_node_compare
|
||||
: Pred(pred)
|
||||
{}
|
||||
|
||||
bool operator()(const Node &a, const Node &b) const
|
||||
Ret operator()(const Node &a, const Node &b) const
|
||||
{ return static_cast<const Pred&>(*this)(a.get_data(), b.get_data()); }
|
||||
|
||||
bool operator()(const Node &a) const
|
||||
Ret operator()(const Node &a) const
|
||||
{ return static_cast<const Pred&>(*this)(a.get_data()); }
|
||||
|
||||
bool operator()(const Node &a, const Node &b)
|
||||
Ret operator()(const Node &a, const Node &b)
|
||||
{ return static_cast<Pred&>(*this)(a.get_data(), b.get_data()); }
|
||||
|
||||
bool operator()(const Node &a)
|
||||
Ret operator()(const Node &a)
|
||||
{ return static_cast<Pred&>(*this)(a.get_data()); }
|
||||
|
||||
predicate_type & predicate() { return static_cast<predicate_type&>(*this); }
|
||||
const predicate_type & predicate() const { return static_cast<predicate_type&>(*this); }
|
||||
};
|
||||
|
||||
template<class KeyPred, class KeyOfValue, class Node, class Ret = bool>
|
||||
struct key_node_pred
|
||||
: public boost::intrusive::detail::ebo_functor_holder<KeyPred>
|
||||
{
|
||||
BOOST_CONTAINER_FORCEINLINE explicit key_node_pred(const KeyPred &comp)
|
||||
: base_t(comp)
|
||||
{}
|
||||
|
||||
typedef boost::intrusive::detail::ebo_functor_holder<KeyPred> base_t;
|
||||
typedef KeyPred key_predicate;
|
||||
typedef KeyOfValue key_of_value;
|
||||
typedef typename KeyOfValue::type key_type;
|
||||
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE static const key_type &key_from(const Node &n)
|
||||
{
|
||||
return key_of_value()(n.get_data());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
BOOST_CONTAINER_FORCEINLINE static const T &
|
||||
key_from(const T &t)
|
||||
{ return t; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const key_predicate &key_pred() const
|
||||
{ return static_cast<const key_predicate &>(*this); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE key_predicate &key_pred()
|
||||
{ return static_cast<key_predicate &>(*this); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE Ret operator()(const key_type &key) const
|
||||
{ return this->key_pred()(key); }
|
||||
|
||||
template<class U>
|
||||
BOOST_CONTAINER_FORCEINLINE Ret operator()(const U &nonkey) const
|
||||
{ return this->key_pred()(this->key_from(nonkey)); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE bool operator()(const key_type &key1, const key_type &key2) const
|
||||
{ return this->key_pred()(key1, key2); }
|
||||
|
||||
template<class U>
|
||||
BOOST_CONTAINER_FORCEINLINE bool operator()(const key_type &key1, const U &nonkey2) const
|
||||
{ return this->key_pred()(key1, this->key_from(nonkey2)); }
|
||||
|
||||
template<class U>
|
||||
BOOST_CONTAINER_FORCEINLINE bool operator()(const U &nonkey1, const key_type &key2) const
|
||||
{ return this->key_pred()(this->key_from(nonkey1), key2); }
|
||||
|
||||
template<class U, class V>
|
||||
BOOST_CONTAINER_FORCEINLINE bool operator()(const U &nonkey1, const V &nonkey2) const
|
||||
{ return this->key_pred()(this->key_from(nonkey1), this->key_from(nonkey2)); }
|
||||
};
|
||||
|
||||
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, InpIt source)
|
||||
template<class DstIt, class U, class D>
|
||||
BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, value_init_construct_iterator<U, D>)
|
||||
{
|
||||
container_detail::value_init<U> val;
|
||||
dtl::value_init<U> val;
|
||||
*dest = boost::move(val.get());
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2017-2017. 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_CONTAINER_OR_ALLOCATOR_REBIND_HPP
|
||||
#define BOOST_CONTAINER_DETAIL_CONTAINER_OR_ALLOCATOR_REBIND_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
#include <boost/container/detail/container_rebind.hpp>
|
||||
#include <boost/container/detail/is_container.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace dtl {
|
||||
|
||||
template<class AllocatorOrContainer, class ToType, bool = is_container<AllocatorOrContainer>::value>
|
||||
struct container_or_allocator_rebind_impl
|
||||
: container_rebind<AllocatorOrContainer, ToType>
|
||||
{};
|
||||
|
||||
template<class AllocatorOrContainer, class ToType>
|
||||
struct container_or_allocator_rebind_impl<AllocatorOrContainer, ToType, false>
|
||||
: allocator_traits<AllocatorOrContainer>::template portable_rebind_alloc<ToType>
|
||||
{};
|
||||
|
||||
template<class ToType>
|
||||
struct container_or_allocator_rebind_impl<void, ToType, false>
|
||||
: real_allocator<ToType, void>
|
||||
{};
|
||||
|
||||
template<class AllocatorOrContainer, class ToType>
|
||||
struct container_or_allocator_rebind
|
||||
: container_or_allocator_rebind_impl<AllocatorOrContainer, ToType>
|
||||
{};
|
||||
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
#endif //#ifndef BOOST_CONTAINER_DETAIL_CONTAINER_OR_ALLOCATOR_REBIND_HPP
|
||||
258
linx64/include/boost/container/detail/container_rebind.hpp
Normal file
258
linx64/include/boost/container/detail/container_rebind.hpp
Normal file
@@ -0,0 +1,258 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2017-2017. 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_CONTAINER_REBIND_HPP
|
||||
#define BOOST_CONTAINER_DETAIL_CONTAINER_REBIND_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace dtl {
|
||||
|
||||
template <class Cont, class U>
|
||||
struct container_rebind;
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
template <template <class, class, class...> class Cont, typename V, typename A, class... An, class U>
|
||||
struct container_rebind<Cont<V, A, An...>, U>
|
||||
{
|
||||
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, An...> type;
|
||||
};
|
||||
|
||||
//Needed for non-conforming compilers like GCC 4.3
|
||||
template <template <class, class> class Cont, typename V, typename A, class U>
|
||||
struct container_rebind<Cont<V, A>, U>
|
||||
{
|
||||
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type> type;
|
||||
};
|
||||
|
||||
template <template <class> class Cont, typename V, class U>
|
||||
struct container_rebind<Cont<V>, U>
|
||||
{
|
||||
typedef Cont<U> type;
|
||||
};
|
||||
|
||||
//for small_vector,static_vector
|
||||
|
||||
template <template <class, std::size_t, class, class...> class Cont, typename V, std::size_t N, typename A, class... An, class U>
|
||||
struct container_rebind<Cont<V, N, A, An...>, U>
|
||||
{
|
||||
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, An...> type;
|
||||
};
|
||||
|
||||
//Needed for non-conforming compilers like GCC 4.3
|
||||
template <template <class, std::size_t, class> class Cont, typename V, std::size_t N, typename A, class U>
|
||||
struct container_rebind<Cont<V, N, A>, U>
|
||||
{
|
||||
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type> type;
|
||||
};
|
||||
|
||||
template <template <class, std::size_t> class Cont, typename V, std::size_t N, class U>
|
||||
struct container_rebind<Cont<V, N>, U>
|
||||
{
|
||||
typedef Cont<U, N> type;
|
||||
};
|
||||
|
||||
#else //C++03 compilers
|
||||
|
||||
template <template <class> class Cont //0arg
|
||||
, typename V
|
||||
, class U>
|
||||
struct container_rebind<Cont<V>, U>
|
||||
{
|
||||
typedef Cont<U> type;
|
||||
};
|
||||
|
||||
template <template <class, class> class Cont //0arg
|
||||
, typename V, typename A
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, A>, U>
|
||||
{
|
||||
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type> type;
|
||||
};
|
||||
|
||||
template <template <class, class, class> class Cont //1arg
|
||||
, typename V, typename A, class P0
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, A, P0>, U>
|
||||
{
|
||||
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0> type;
|
||||
};
|
||||
|
||||
template <template <class, class, class, class> class Cont //2arg
|
||||
, typename V, typename A, class P0, class P1
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, A, P0, P1>, U>
|
||||
{
|
||||
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1> type;
|
||||
};
|
||||
|
||||
template <template <class, class, class, class, class> class Cont //3arg
|
||||
, typename V, typename A, class P0, class P1, class P2
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, A, P0, P1, P2>, U>
|
||||
{
|
||||
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2> type;
|
||||
};
|
||||
|
||||
template <template <class, class, class, class, class, class> class Cont //4arg
|
||||
, typename V, typename A, class P0, class P1, class P2, class P3
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, A, P0, P1, P2, P3>, U>
|
||||
{
|
||||
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3> type;
|
||||
};
|
||||
|
||||
template <template <class, class, class, class, class, class, class> class Cont //5arg
|
||||
, typename V, typename A, class P0, class P1, class P2, class P3, class P4
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4>, U>
|
||||
{
|
||||
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4> type;
|
||||
};
|
||||
|
||||
template <template <class, class, class, class, class, class, class, class> class Cont //6arg
|
||||
, typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5>, U>
|
||||
{
|
||||
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5> type;
|
||||
};
|
||||
|
||||
template <template <class, class, class, class, class, class, class, class, class> class Cont //7arg
|
||||
, typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6>, U>
|
||||
{
|
||||
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6> type;
|
||||
};
|
||||
|
||||
template <template <class, class, class, class, class, class, class, class, class, class> class Cont //8arg
|
||||
, typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6, P7>, U>
|
||||
{
|
||||
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6, P7> type;
|
||||
};
|
||||
|
||||
template <template <class, class, class, class, class, class, class, class, class, class, class> class Cont //9arg
|
||||
, typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6, P7, P8>, U>
|
||||
{
|
||||
typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6, P7, P8> type;
|
||||
};
|
||||
|
||||
//For small_vector/static_vector
|
||||
template <template <class, std::size_t> class Cont //0arg
|
||||
, typename V, std::size_t N
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, N>, U>
|
||||
{
|
||||
typedef Cont<U, N> type;
|
||||
};
|
||||
|
||||
template <template <class, std::size_t, class> class Cont //0arg
|
||||
, typename V, std::size_t N, typename A
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, N, A>, U>
|
||||
{
|
||||
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type> type;
|
||||
};
|
||||
|
||||
template <template <class, std::size_t, class, class> class Cont //1arg
|
||||
, typename V, std::size_t N, typename A, class P0
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, N, A, P0>, U>
|
||||
{
|
||||
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0> type;
|
||||
};
|
||||
|
||||
template <template <class, std::size_t, class, class, class> class Cont //2arg
|
||||
, typename V, std::size_t N, typename A, class P0, class P1
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, N, A, P0, P1>, U>
|
||||
{
|
||||
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1> type;
|
||||
};
|
||||
|
||||
template <template <class, std::size_t, class, class, class, class> class Cont //3arg
|
||||
, typename V, std::size_t N, typename A, class P0, class P1, class P2
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, N, A, P0, P1, P2>, U>
|
||||
{
|
||||
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2> type;
|
||||
};
|
||||
|
||||
template <template <class, std::size_t, class, class, class, class, class> class Cont //4arg
|
||||
, typename V, std::size_t N, typename A, class P0, class P1, class P2, class P3
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, N, A, P0, P1, P2, P3>, U>
|
||||
{
|
||||
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3> type;
|
||||
};
|
||||
|
||||
template <template <class, std::size_t, class, class, class, class, class, class> class Cont //5arg
|
||||
, typename V, std::size_t N, typename A, class P0, class P1, class P2, class P3, class P4
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, N, A, P0, P1, P2, P3, P4>, U>
|
||||
{
|
||||
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4> type;
|
||||
};
|
||||
|
||||
template <template <class, std::size_t, class, class, class, class, class, class, class> class Cont //6arg
|
||||
, typename V, std::size_t N, typename A, class P0, class P1, class P2, class P3, class P4, class P5
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, N, A, P0, P1, P2, P3, P4, P5>, U>
|
||||
{
|
||||
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5> type;
|
||||
};
|
||||
|
||||
template <template <class, std::size_t, class, class, class, class, class, class, class, class> class Cont //7arg
|
||||
, typename V, std::size_t N, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, N, A, P0, P1, P2, P3, P4, P5, P6>, U>
|
||||
{
|
||||
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6> type;
|
||||
};
|
||||
|
||||
template <template <class, std::size_t, class, class, class, class, class, class, class, class, class> class Cont //8arg
|
||||
, typename V, std::size_t N, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, N, A, P0, P1, P2, P3, P4, P5, P6, P7>, U>
|
||||
{
|
||||
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6, P7> type;
|
||||
};
|
||||
|
||||
template <template <class, std::size_t, class, class, class, class, class, class, class, class, class, class> class Cont //9arg
|
||||
, typename V, std::size_t N, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8
|
||||
, class U>
|
||||
struct container_rebind<Cont<V, N, A, P0, P1, P2, P3, P4, P5, P6, P7, P8>, U>
|
||||
{
|
||||
typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6, P7, P8> type;
|
||||
};
|
||||
|
||||
#endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
#endif //#ifndef BOOST_CONTAINER_DETAIL_CONTAINER_REBIND_HPP
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
// container/detail
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
#include <boost/container/detail/iterator_to_raw_pointer.hpp>
|
||||
#include <boost/move/detail/iterator_to_raw_pointer.hpp>
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
#include <boost/container/detail/type_traits.hpp>
|
||||
#include <boost/container/detail/construct_in_place.hpp>
|
||||
@@ -34,11 +34,25 @@
|
||||
// other
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
// std
|
||||
#include <cstring> //for emmove/memcpy
|
||||
#include <cstring> //for memmove/memcpy
|
||||
|
||||
#if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
|
||||
#pragma GCC diagnostic push
|
||||
//pair memcpy optimizations rightfully detected by GCC
|
||||
# if defined(BOOST_GCC) && (BOOST_GCC >= 80000)
|
||||
# pragma GCC diagnostic ignored "-Wclass-memaccess"
|
||||
# endif
|
||||
//GCC 8 seems a bit confused about array access error with static_vector
|
||||
//when out of bound exceptions are being thrown.
|
||||
# if defined(BOOST_GCC) && (BOOST_GCC >= 80000) && (BOOST_GCC < 80200)
|
||||
# pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||
# endif
|
||||
# pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
template<class I>
|
||||
struct are_elements_contiguous
|
||||
@@ -65,21 +79,15 @@ struct are_elements_contiguous< ::boost::move_iterator<It> >
|
||||
: are_elements_contiguous<It>
|
||||
{};
|
||||
|
||||
} //namespace dtl {
|
||||
|
||||
/////////////////////////
|
||||
// predeclarations
|
||||
/////////////////////////
|
||||
|
||||
#ifndef BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
|
||||
template <class Pointer, bool IsConst>
|
||||
class vec_iterator;
|
||||
|
||||
template<class Pointer>
|
||||
class vector_iterator;
|
||||
|
||||
template<class Pointer>
|
||||
class vector_const_iterator;
|
||||
|
||||
#endif //BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace container {
|
||||
|
||||
namespace interprocess {
|
||||
@@ -91,28 +99,18 @@ class offset_ptr;
|
||||
|
||||
namespace container {
|
||||
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
/////////////////////////
|
||||
//vector_[const_]iterator
|
||||
/////////////////////////
|
||||
|
||||
#ifndef BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
|
||||
|
||||
template<class Pointer>
|
||||
struct are_elements_contiguous<boost::container::container_detail::vector_iterator<Pointer> >
|
||||
template <class Pointer, bool IsConst>
|
||||
struct are_elements_contiguous<boost::container::vec_iterator<Pointer, IsConst> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template<class Pointer>
|
||||
struct are_elements_contiguous<boost::container::container_detail::vector_const_iterator<Pointer> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
#endif //BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
|
||||
|
||||
/////////////////////////
|
||||
// offset_ptr
|
||||
/////////////////////////
|
||||
@@ -138,7 +136,7 @@ template <typename I, typename O>
|
||||
struct is_memtransfer_copy_assignable
|
||||
: boost::move_detail::and_
|
||||
< are_contiguous_and_same<I, O>
|
||||
, container_detail::is_trivially_copy_assignable< typename ::boost::container::iterator_traits<I>::value_type >
|
||||
, dtl::is_trivially_copy_assignable< typename ::boost::container::iterator_traits<I>::value_type >
|
||||
>
|
||||
{};
|
||||
|
||||
@@ -146,28 +144,28 @@ template <typename I, typename O>
|
||||
struct is_memtransfer_copy_constructible
|
||||
: boost::move_detail::and_
|
||||
< are_contiguous_and_same<I, O>
|
||||
, container_detail::is_trivially_copy_constructible< typename ::boost::container::iterator_traits<I>::value_type >
|
||||
, dtl::is_trivially_copy_constructible< typename ::boost::container::iterator_traits<I>::value_type >
|
||||
>
|
||||
{};
|
||||
|
||||
template <typename I, typename O, typename R>
|
||||
struct enable_if_memtransfer_copy_constructible
|
||||
: enable_if<container_detail::is_memtransfer_copy_constructible<I, O>, R>
|
||||
: enable_if<dtl::is_memtransfer_copy_constructible<I, O>, R>
|
||||
{};
|
||||
|
||||
template <typename I, typename O, typename R>
|
||||
struct disable_if_memtransfer_copy_constructible
|
||||
: disable_if<container_detail::is_memtransfer_copy_constructible<I, O>, R>
|
||||
: disable_if<dtl::is_memtransfer_copy_constructible<I, O>, R>
|
||||
{};
|
||||
|
||||
template <typename I, typename O, typename R>
|
||||
struct enable_if_memtransfer_copy_assignable
|
||||
: enable_if<container_detail::is_memtransfer_copy_assignable<I, O>, R>
|
||||
: enable_if<dtl::is_memtransfer_copy_assignable<I, O>, R>
|
||||
{};
|
||||
|
||||
template <typename I, typename O, typename R>
|
||||
struct disable_if_memtransfer_copy_assignable
|
||||
: disable_if<container_detail::is_memtransfer_copy_assignable<I, O>, R>
|
||||
: disable_if<dtl::is_memtransfer_copy_assignable<I, O>, R>
|
||||
{};
|
||||
|
||||
template
|
||||
@@ -176,9 +174,13 @@ template
|
||||
inline F memmove(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
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);
|
||||
if(n){
|
||||
std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n);
|
||||
value_type *const dest_raw = boost::movelib::iterator_to_raw_pointer(r);
|
||||
const value_type *const beg_raw = boost::movelib::iterator_to_raw_pointer(f);
|
||||
const value_type *const end_raw = boost::movelib::iterator_to_raw_pointer(l);
|
||||
if(BOOST_LIKELY(beg_raw != end_raw)){
|
||||
BOOST_ASSERT(beg_raw != 0);
|
||||
const typename boost::container::iterator_traits<I>::difference_type n = end_raw - beg_raw;
|
||||
std::memmove(dest_raw, beg_raw, sizeof(value_type)*n);
|
||||
boost::container::iterator_advance(r, n);
|
||||
}
|
||||
return r;
|
||||
@@ -191,10 +193,11 @@ template
|
||||
F memmove_n(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
typedef typename boost::container::iterator_traits<I>::value_type value_type;
|
||||
if(n){
|
||||
std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n);
|
||||
if(BOOST_LIKELY(n)){
|
||||
std::memmove(boost::movelib::iterator_to_raw_pointer(r), boost::movelib::iterator_to_raw_pointer(f), sizeof(value_type)*n);
|
||||
boost::container::iterator_advance(r, n);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -204,9 +207,9 @@ template
|
||||
typename F> // F models ForwardIterator
|
||||
I memmove_n_source(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
if(n){
|
||||
if(BOOST_LIKELY(n)){
|
||||
typedef typename boost::container::iterator_traits<I>::value_type value_type;
|
||||
std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n);
|
||||
std::memmove(boost::movelib::iterator_to_raw_pointer(r), boost::movelib::iterator_to_raw_pointer(f), sizeof(value_type)*n);
|
||||
boost::container::iterator_advance(f, n);
|
||||
}
|
||||
return f;
|
||||
@@ -219,8 +222,8 @@ template
|
||||
I memmove_n_source_dest(I f, U n, F &r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
typedef typename boost::container::iterator_traits<I>::value_type value_type;
|
||||
if(n){
|
||||
std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n);
|
||||
if(BOOST_LIKELY(n)){
|
||||
std::memmove(boost::movelib::iterator_to_raw_pointer(r), boost::movelib::iterator_to_raw_pointer(f), sizeof(value_type)*n);
|
||||
boost::container::iterator_advance(f, n);
|
||||
boost::container::iterator_advance(r, n);
|
||||
}
|
||||
@@ -232,44 +235,44 @@ struct is_memzero_initializable
|
||||
{
|
||||
typedef typename ::boost::container::iterator_traits<O>::value_type value_type;
|
||||
static const bool value = are_elements_contiguous<O>::value &&
|
||||
( container_detail::is_integral<value_type>::value || container_detail::is_enum<value_type>::value
|
||||
( dtl::is_integral<value_type>::value || dtl::is_enum<value_type>::value
|
||||
#if defined(BOOST_CONTAINER_MEMZEROED_POINTER_IS_NULL)
|
||||
|| container_detail::is_pointer<value_type>::value
|
||||
|| dtl::is_pointer<value_type>::value
|
||||
#endif
|
||||
#if defined(BOOST_CONTAINER_MEMZEROED_FLOATING_POINT_IS_ZERO)
|
||||
|| container_detail::is_floating_point<value_type>::value
|
||||
|| dtl::is_floating_point<value_type>::value
|
||||
#endif
|
||||
#if defined(BOOST_CONTAINER_MEMZEROED_FLOATING_POINT_IS_ZERO) && defined(BOOST_CONTAINER_MEMZEROED_POINTER_IS_NULL)
|
||||
|| container_detail::is_pod<value_type>::value
|
||||
|| dtl::is_pod<value_type>::value
|
||||
#endif
|
||||
);
|
||||
};
|
||||
|
||||
template <typename O, typename R>
|
||||
struct enable_if_memzero_initializable
|
||||
: enable_if_c<container_detail::is_memzero_initializable<O>::value, R>
|
||||
: enable_if_c<dtl::is_memzero_initializable<O>::value, R>
|
||||
{};
|
||||
|
||||
template <typename O, typename R>
|
||||
struct disable_if_memzero_initializable
|
||||
: enable_if_c<!container_detail::is_memzero_initializable<O>::value, R>
|
||||
: enable_if_c<!dtl::is_memzero_initializable<O>::value, R>
|
||||
{};
|
||||
|
||||
template <typename I, typename R>
|
||||
struct enable_if_trivially_destructible
|
||||
: enable_if_c < container_detail::is_trivially_destructible
|
||||
: enable_if_c < dtl::is_trivially_destructible
|
||||
<typename boost::container::iterator_traits<I>::value_type>::value
|
||||
, R>
|
||||
{};
|
||||
|
||||
template <typename I, typename R>
|
||||
struct disable_if_trivially_destructible
|
||||
: enable_if_c <!container_detail::is_trivially_destructible
|
||||
: enable_if_c <!dtl::is_trivially_destructible
|
||||
<typename boost::container::iterator_traits<I>::value_type>::value
|
||||
, R>
|
||||
{};
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -289,19 +292,19 @@ template
|
||||
<typename Allocator,
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
uninitialized_move_alloc(Allocator &a, I f, I l, F r)
|
||||
{
|
||||
F back = r;
|
||||
BOOST_TRY{
|
||||
while (f != l) {
|
||||
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), boost::move(*f));
|
||||
allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), boost::move(*f));
|
||||
++f; ++r;
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
for (; back != r; ++back){
|
||||
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
|
||||
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
|
||||
}
|
||||
BOOST_RETHROW;
|
||||
}
|
||||
@@ -313,9 +316,9 @@ template
|
||||
<typename Allocator,
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
inline typename dtl::enable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
uninitialized_move_alloc(Allocator &, I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return container_detail::memmove(f, l, r); }
|
||||
{ return dtl::memmove(f, l, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -334,19 +337,19 @@ template
|
||||
<typename Allocator,
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
uninitialized_move_alloc_n(Allocator &a, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r)
|
||||
{
|
||||
F back = r;
|
||||
BOOST_TRY{
|
||||
while (n--) {
|
||||
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), boost::move(*f));
|
||||
allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), boost::move(*f));
|
||||
++f; ++r;
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
for (; back != r; ++back){
|
||||
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
|
||||
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
|
||||
}
|
||||
BOOST_RETHROW;
|
||||
}
|
||||
@@ -358,9 +361,9 @@ template
|
||||
<typename Allocator,
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
inline typename dtl::enable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
uninitialized_move_alloc_n(Allocator &, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return container_detail::memmove_n(f, n, r); }
|
||||
{ return dtl::memmove_n(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -379,19 +382,19 @@ template
|
||||
<typename Allocator,
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, I>::type
|
||||
inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, I>::type
|
||||
uninitialized_move_alloc_n_source(Allocator &a, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r)
|
||||
{
|
||||
F back = r;
|
||||
BOOST_TRY{
|
||||
while (n--) {
|
||||
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), boost::move(*f));
|
||||
allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), boost::move(*f));
|
||||
++f; ++r;
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
for (; back != r; ++back){
|
||||
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
|
||||
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
|
||||
}
|
||||
BOOST_RETHROW;
|
||||
}
|
||||
@@ -403,9 +406,9 @@ template
|
||||
<typename Allocator,
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, I>::type
|
||||
inline typename dtl::enable_if_memtransfer_copy_constructible<I, F, I>::type
|
||||
uninitialized_move_alloc_n_source(Allocator &, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return container_detail::memmove_n_source(f, n, r); }
|
||||
{ return dtl::memmove_n_source(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -424,19 +427,19 @@ template
|
||||
<typename Allocator,
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
uninitialized_copy_alloc(Allocator &a, I f, I l, F r)
|
||||
{
|
||||
F back = r;
|
||||
BOOST_TRY{
|
||||
while (f != l) {
|
||||
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), *f);
|
||||
allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), *f);
|
||||
++f; ++r;
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
for (; back != r; ++back){
|
||||
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
|
||||
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
|
||||
}
|
||||
BOOST_RETHROW;
|
||||
}
|
||||
@@ -448,9 +451,9 @@ template
|
||||
<typename Allocator,
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
inline typename dtl::enable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
uninitialized_copy_alloc(Allocator &, I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return container_detail::memmove(f, l, r); }
|
||||
{ return dtl::memmove(f, l, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -469,19 +472,19 @@ template
|
||||
<typename Allocator,
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
uninitialized_copy_alloc_n(Allocator &a, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r)
|
||||
{
|
||||
F back = r;
|
||||
BOOST_TRY{
|
||||
while (n--) {
|
||||
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), *f);
|
||||
allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), *f);
|
||||
++f; ++r;
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
for (; back != r; ++back){
|
||||
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
|
||||
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
|
||||
}
|
||||
BOOST_RETHROW;
|
||||
}
|
||||
@@ -493,9 +496,9 @@ template
|
||||
<typename Allocator,
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
inline typename dtl::enable_if_memtransfer_copy_constructible<I, F, F>::type
|
||||
uninitialized_copy_alloc_n(Allocator &, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return container_detail::memmove_n(f, n, r); }
|
||||
{ return dtl::memmove_n(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -514,19 +517,19 @@ template
|
||||
<typename Allocator,
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, I>::type
|
||||
inline typename dtl::disable_if_memtransfer_copy_constructible<I, F, I>::type
|
||||
uninitialized_copy_alloc_n_source(Allocator &a, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r)
|
||||
{
|
||||
F back = r;
|
||||
BOOST_TRY{
|
||||
while (n--) {
|
||||
boost::container::construct_in_place(a, container_detail::iterator_to_raw_pointer(r), f);
|
||||
boost::container::construct_in_place(a, boost::movelib::iterator_to_raw_pointer(r), f);
|
||||
++f; ++r;
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
for (; back != r; ++back){
|
||||
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
|
||||
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
|
||||
}
|
||||
BOOST_RETHROW;
|
||||
}
|
||||
@@ -538,9 +541,9 @@ template
|
||||
<typename Allocator,
|
||||
typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, I>::type
|
||||
inline typename dtl::enable_if_memtransfer_copy_constructible<I, F, I>::type
|
||||
uninitialized_copy_alloc_n_source(Allocator &, I f, typename boost::container::allocator_traits<Allocator>::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return container_detail::memmove_n_source(f, n, r); }
|
||||
{ return dtl::memmove_n_source(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -558,19 +561,19 @@ inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F,
|
||||
template
|
||||
<typename Allocator,
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memzero_initializable<F, F>::type
|
||||
inline typename dtl::disable_if_memzero_initializable<F, F>::type
|
||||
uninitialized_value_init_alloc_n(Allocator &a, typename boost::container::allocator_traits<Allocator>::size_type n, F r)
|
||||
{
|
||||
F back = r;
|
||||
BOOST_TRY{
|
||||
while (n--) {
|
||||
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r));
|
||||
allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r));
|
||||
++r;
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
for (; back != r; ++back){
|
||||
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
|
||||
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
|
||||
}
|
||||
BOOST_RETHROW;
|
||||
}
|
||||
@@ -581,11 +584,11 @@ inline typename container_detail::disable_if_memzero_initializable<F, F>::type
|
||||
template
|
||||
<typename Allocator,
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memzero_initializable<F, F>::type
|
||||
inline typename dtl::enable_if_memzero_initializable<F, F>::type
|
||||
uninitialized_value_init_alloc_n(Allocator &, typename boost::container::allocator_traits<Allocator>::size_type n, F r)
|
||||
{
|
||||
typedef typename boost::container::iterator_traits<F>::value_type value_type;
|
||||
std::memset((void*)container_detail::iterator_to_raw_pointer(r), 0, sizeof(value_type)*n);
|
||||
std::memset((void*)boost::movelib::iterator_to_raw_pointer(r), 0, sizeof(value_type)*n);
|
||||
boost::container::iterator_advance(r, n);
|
||||
return r;
|
||||
}
|
||||
@@ -611,13 +614,13 @@ inline F uninitialized_default_init_alloc_n(Allocator &a, typename boost::contai
|
||||
F back = r;
|
||||
BOOST_TRY{
|
||||
while (n--) {
|
||||
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), default_init);
|
||||
allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), default_init);
|
||||
++r;
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
for (; back != r; ++back){
|
||||
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
|
||||
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
|
||||
}
|
||||
BOOST_RETHROW;
|
||||
}
|
||||
@@ -647,13 +650,13 @@ inline void uninitialized_fill_alloc(Allocator &a, F f, F l, const T &t)
|
||||
F back = f;
|
||||
BOOST_TRY{
|
||||
while (f != l) {
|
||||
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(f), t);
|
||||
allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(f), t);
|
||||
++f;
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
for (; back != l; ++back){
|
||||
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
|
||||
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
|
||||
}
|
||||
BOOST_RETHROW;
|
||||
}
|
||||
@@ -683,13 +686,13 @@ inline F uninitialized_fill_alloc_n(Allocator &a, const T &v, typename boost::co
|
||||
F back = r;
|
||||
BOOST_TRY{
|
||||
while (n--) {
|
||||
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), v);
|
||||
allocator_traits<Allocator>::construct(a, boost::movelib::iterator_to_raw_pointer(r), v);
|
||||
++r;
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
for (; back != r; ++back){
|
||||
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
|
||||
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(back));
|
||||
}
|
||||
BOOST_RETHROW;
|
||||
}
|
||||
@@ -706,7 +709,7 @@ inline F uninitialized_fill_alloc_n(Allocator &a, const T &v, typename boost::co
|
||||
template
|
||||
<typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
copy(I f, I l, F r)
|
||||
{
|
||||
while (f != l) {
|
||||
@@ -719,9 +722,9 @@ inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F
|
||||
template
|
||||
<typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
inline typename dtl::enable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
copy(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return container_detail::memmove(f, l, r); }
|
||||
{ return dtl::memmove(f, l, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -733,10 +736,11 @@ template
|
||||
<typename I, // I models InputIterator
|
||||
typename U, // U models unsigned integral constant
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
copy_n(I f, U n, F r)
|
||||
{
|
||||
while (n--) {
|
||||
while (n) {
|
||||
--n;
|
||||
*r = *f;
|
||||
++f; ++r;
|
||||
}
|
||||
@@ -747,9 +751,9 @@ template
|
||||
<typename I, // I models InputIterator
|
||||
typename U, // U models unsigned integral constant
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
inline typename dtl::enable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
copy_n(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return container_detail::memmove_n(f, n, r); }
|
||||
{ return dtl::memmove_n(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -761,7 +765,7 @@ template
|
||||
<typename I, // I models InputIterator
|
||||
typename U, // U models unsigned integral constant
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
copy_n_source(I f, U n, F r)
|
||||
{
|
||||
while (n--) {
|
||||
@@ -775,9 +779,9 @@ template
|
||||
<typename I, // I models InputIterator
|
||||
typename U, // U models unsigned integral constant
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
inline typename dtl::enable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
copy_n_source(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return container_detail::memmove_n_source(f, n, r); }
|
||||
{ return dtl::memmove_n_source(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -789,7 +793,7 @@ template
|
||||
<typename I, // I models InputIterator
|
||||
typename U, // U models unsigned integral constant
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
copy_n_source_dest(I f, U n, F &r)
|
||||
{
|
||||
while (n--) {
|
||||
@@ -803,9 +807,9 @@ template
|
||||
<typename I, // I models InputIterator
|
||||
typename U, // U models unsigned integral constant
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
inline typename dtl::enable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
copy_n_source_dest(I f, U n, F &r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return container_detail::memmove_n_source_dest(f, n, r); }
|
||||
{ return dtl::memmove_n_source_dest(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -816,7 +820,7 @@ inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>
|
||||
template
|
||||
<typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
move(I f, I l, F r)
|
||||
{
|
||||
while (f != l) {
|
||||
@@ -829,9 +833,9 @@ inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F
|
||||
template
|
||||
<typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
inline typename dtl::enable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
move(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return container_detail::memmove(f, l, r); }
|
||||
{ return dtl::memmove(f, l, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -843,7 +847,7 @@ template
|
||||
<typename I, // I models InputIterator
|
||||
typename U, // U models unsigned integral constant
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
move_n(I f, U n, F r)
|
||||
{
|
||||
while (n--) {
|
||||
@@ -857,9 +861,9 @@ template
|
||||
<typename I, // I models InputIterator
|
||||
typename U, // U models unsigned integral constant
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
inline typename dtl::enable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
move_n(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return container_detail::memmove_n(f, n, r); }
|
||||
{ return dtl::memmove_n(f, n, r); }
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -871,7 +875,7 @@ inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>
|
||||
template
|
||||
<typename I, // I models BidirectionalIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
move_backward(I f, I l, F r)
|
||||
{
|
||||
while (f != l) {
|
||||
@@ -884,13 +888,13 @@ inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F
|
||||
template
|
||||
<typename I, // I models InputIterator
|
||||
typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
inline typename dtl::enable_if_memtransfer_copy_assignable<I, F, F>::type
|
||||
move_backward(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
typedef typename boost::container::iterator_traits<I>::value_type value_type;
|
||||
const typename boost::container::iterator_traits<I>::difference_type n = boost::container::iterator_distance(f, l);
|
||||
r -= n;
|
||||
std::memmove((container_detail::iterator_to_raw_pointer)(r), (container_detail::iterator_to_raw_pointer)(f), sizeof(value_type)*n);
|
||||
std::memmove((boost::movelib::iterator_to_raw_pointer)(r), (boost::movelib::iterator_to_raw_pointer)(f), sizeof(value_type)*n);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -904,7 +908,7 @@ template
|
||||
<typename I // I models InputIterator
|
||||
,typename U // U models unsigned integral constant
|
||||
,typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
move_n_source_dest(I f, U n, F &r)
|
||||
{
|
||||
while (n--) {
|
||||
@@ -918,9 +922,9 @@ template
|
||||
<typename I // I models InputIterator
|
||||
,typename U // U models unsigned integral constant
|
||||
,typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
inline typename dtl::enable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
move_n_source_dest(I f, U n, F &r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return container_detail::memmove_n_source_dest(f, n, r); }
|
||||
{ return dtl::memmove_n_source_dest(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -932,7 +936,7 @@ template
|
||||
<typename I // I models InputIterator
|
||||
,typename U // U models unsigned integral constant
|
||||
,typename F> // F models ForwardIterator
|
||||
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
inline typename dtl::disable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
move_n_source(I f, U n, F r)
|
||||
{
|
||||
while (n--) {
|
||||
@@ -946,9 +950,9 @@ template
|
||||
<typename I // I models InputIterator
|
||||
,typename U // U models unsigned integral constant
|
||||
,typename F> // F models ForwardIterator
|
||||
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
inline typename dtl::enable_if_memtransfer_copy_assignable<I, F, I>::type
|
||||
move_n_source(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ return container_detail::memmove_n_source(f, n, r); }
|
||||
{ return dtl::memmove_n_source(f, n, r); }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -960,11 +964,12 @@ template
|
||||
<typename Allocator
|
||||
,typename I // I models InputIterator
|
||||
,typename U> // U models unsigned integral constant
|
||||
inline typename container_detail::disable_if_trivially_destructible<I, void>::type
|
||||
inline typename dtl::disable_if_trivially_destructible<I, void>::type
|
||||
destroy_alloc_n(Allocator &a, I f, U n)
|
||||
{
|
||||
while(n--){
|
||||
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(f));
|
||||
while(n){
|
||||
--n;
|
||||
allocator_traits<Allocator>::destroy(a, boost::movelib::iterator_to_raw_pointer(f));
|
||||
++f;
|
||||
}
|
||||
}
|
||||
@@ -973,7 +978,7 @@ template
|
||||
<typename Allocator
|
||||
,typename I // I models InputIterator
|
||||
,typename U> // U models unsigned integral constant
|
||||
inline typename container_detail::enable_if_trivially_destructible<I, void>::type
|
||||
inline typename dtl::enable_if_trivially_destructible<I, void>::type
|
||||
destroy_alloc_n(Allocator &, I, U)
|
||||
{}
|
||||
|
||||
@@ -989,7 +994,7 @@ template
|
||||
,typename F // F models ForwardIterator
|
||||
,typename G // G models ForwardIterator
|
||||
>
|
||||
inline typename container_detail::disable_if_memtransfer_copy_assignable<F, G, void>::type
|
||||
inline typename dtl::disable_if_memtransfer_copy_assignable<F, G, void>::type
|
||||
deep_swap_alloc_n( Allocator &a, F short_range_f, typename allocator_traits<Allocator>::size_type n_i
|
||||
, G large_range_f, typename allocator_traits<Allocator>::size_type n_j)
|
||||
{
|
||||
@@ -1009,21 +1014,21 @@ template
|
||||
,typename F // F models ForwardIterator
|
||||
,typename G // G models ForwardIterator
|
||||
>
|
||||
inline typename container_detail::enable_if_c
|
||||
< container_detail::is_memtransfer_copy_assignable<F, G>::value && (MaxTmpBytes <= DeepSwapAllocNMaxStorage) && false
|
||||
inline typename dtl::enable_if_c
|
||||
< dtl::is_memtransfer_copy_assignable<F, G>::value && (MaxTmpBytes <= DeepSwapAllocNMaxStorage) && false
|
||||
, void>::type
|
||||
deep_swap_alloc_n( Allocator &a, F short_range_f, typename allocator_traits<Allocator>::size_type n_i
|
||||
, G large_range_f, typename allocator_traits<Allocator>::size_type n_j)
|
||||
{
|
||||
typedef typename allocator_traits<Allocator>::value_type value_type;
|
||||
typedef typename container_detail::aligned_storage
|
||||
<MaxTmpBytes, container_detail::alignment_of<value_type>::value>::type storage_type;
|
||||
typedef typename dtl::aligned_storage
|
||||
<MaxTmpBytes, dtl::alignment_of<value_type>::value>::type storage_type;
|
||||
storage_type storage;
|
||||
|
||||
const std::size_t n_i_bytes = sizeof(value_type)*n_i;
|
||||
void *const large_ptr = static_cast<void*>(container_detail::iterator_to_raw_pointer(large_range_f));
|
||||
void *const short_ptr = static_cast<void*>(container_detail::iterator_to_raw_pointer(short_range_f));
|
||||
void *const stora_ptr = static_cast<void*>(container_detail::iterator_to_raw_pointer(storage));
|
||||
void *const large_ptr = static_cast<void*>(boost::movelib::iterator_to_raw_pointer(large_range_f));
|
||||
void *const short_ptr = static_cast<void*>(boost::movelib::iterator_to_raw_pointer(short_range_f));
|
||||
void *const stora_ptr = static_cast<void*>(boost::movelib::iterator_to_raw_pointer(storage.data));
|
||||
std::memcpy(stora_ptr, large_ptr, n_i_bytes);
|
||||
std::memcpy(large_ptr, short_ptr, n_i_bytes);
|
||||
std::memcpy(short_ptr, stora_ptr, n_i_bytes);
|
||||
@@ -1039,22 +1044,22 @@ template
|
||||
,typename F // F models ForwardIterator
|
||||
,typename G // G models ForwardIterator
|
||||
>
|
||||
inline typename container_detail::enable_if_c
|
||||
< container_detail::is_memtransfer_copy_assignable<F, G>::value && true//(MaxTmpBytes > DeepSwapAllocNMaxStorage)
|
||||
inline typename dtl::enable_if_c
|
||||
< dtl::is_memtransfer_copy_assignable<F, G>::value && true//(MaxTmpBytes > DeepSwapAllocNMaxStorage)
|
||||
, void>::type
|
||||
deep_swap_alloc_n( Allocator &a, F short_range_f, typename allocator_traits<Allocator>::size_type n_i
|
||||
, G large_range_f, typename allocator_traits<Allocator>::size_type n_j)
|
||||
{
|
||||
typedef typename allocator_traits<Allocator>::value_type value_type;
|
||||
typedef typename container_detail::aligned_storage
|
||||
<DeepSwapAllocNMaxStorage, container_detail::alignment_of<value_type>::value>::type storage_type;
|
||||
typedef typename dtl::aligned_storage
|
||||
<DeepSwapAllocNMaxStorage, dtl::alignment_of<value_type>::value>::type storage_type;
|
||||
storage_type storage;
|
||||
const std::size_t sizeof_storage = sizeof(storage);
|
||||
|
||||
std::size_t n_i_bytes = sizeof(value_type)*n_i;
|
||||
char *large_ptr = static_cast<char*>(static_cast<void*>(container_detail::iterator_to_raw_pointer(large_range_f)));
|
||||
char *short_ptr = static_cast<char*>(static_cast<void*>(container_detail::iterator_to_raw_pointer(short_range_f)));
|
||||
char *stora_ptr = static_cast<char*>(static_cast<void*>(&storage));
|
||||
char *large_ptr = static_cast<char*>(static_cast<void*>(boost::movelib::iterator_to_raw_pointer(large_range_f)));
|
||||
char *short_ptr = static_cast<char*>(static_cast<void*>(boost::movelib::iterator_to_raw_pointer(short_range_f)));
|
||||
char *stora_ptr = static_cast<char*>(static_cast<void*>(storage.data));
|
||||
|
||||
std::size_t szt_times = n_i_bytes/sizeof_storage;
|
||||
const std::size_t szt_rem = n_i_bytes%sizeof_storage;
|
||||
@@ -1072,21 +1077,21 @@ inline typename container_detail::enable_if_c
|
||||
std::memcpy(short_ptr, stora_ptr, sizeof_storage);
|
||||
large_ptr += sizeof_storage;
|
||||
short_ptr += sizeof_storage;
|
||||
BOOST_CONTAINER_FALLTHOUGH
|
||||
BOOST_FALLTHROUGH;
|
||||
case 3:
|
||||
std::memcpy(stora_ptr, large_ptr, sizeof_storage);
|
||||
std::memcpy(large_ptr, short_ptr, sizeof_storage);
|
||||
std::memcpy(short_ptr, stora_ptr, sizeof_storage);
|
||||
large_ptr += sizeof_storage;
|
||||
short_ptr += sizeof_storage;
|
||||
BOOST_CONTAINER_FALLTHOUGH
|
||||
BOOST_FALLTHROUGH;
|
||||
case 2:
|
||||
std::memcpy(stora_ptr, large_ptr, sizeof_storage);
|
||||
std::memcpy(large_ptr, short_ptr, sizeof_storage);
|
||||
std::memcpy(short_ptr, stora_ptr, sizeof_storage);
|
||||
large_ptr += sizeof_storage;
|
||||
short_ptr += sizeof_storage;
|
||||
BOOST_CONTAINER_FALLTHOUGH
|
||||
BOOST_FALLTHROUGH;
|
||||
case 1:
|
||||
std::memcpy(stora_ptr, large_ptr, sizeof_storage);
|
||||
std::memcpy(large_ptr, short_ptr, sizeof_storage);
|
||||
@@ -1156,4 +1161,9 @@ void move_assign_range_alloc_n( Allocator &a, I inp_start, typename allocator_tr
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
//#pragma GCC diagnostic ignored "-Wclass-memaccess"
|
||||
#if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif //#ifndef BOOST_CONTAINER_DETAIL_COPY_MOVE_ALGO_HPP
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
#include <boost/container/detail/workaround.hpp>
|
||||
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
#include <boost/container/detail/to_raw_pointer.hpp>
|
||||
#include <boost/move/detail/to_raw_pointer.hpp>
|
||||
#include <boost/container/detail/version_type.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
//!A deleter for scoped_ptr that deallocates the memory
|
||||
//!allocated for an object using a STL allocator.
|
||||
@@ -39,8 +39,8 @@ struct scoped_deallocator
|
||||
{
|
||||
typedef allocator_traits<Allocator> allocator_traits_type;
|
||||
typedef typename allocator_traits_type::pointer pointer;
|
||||
typedef container_detail::integral_constant<unsigned,
|
||||
boost::container::container_detail::
|
||||
typedef dtl::integral_constant<unsigned,
|
||||
boost::container::dtl::
|
||||
version<Allocator>::value> alloc_version;
|
||||
|
||||
private:
|
||||
@@ -142,8 +142,8 @@ struct scoped_destroy_deallocator
|
||||
typedef boost::container::allocator_traits<Allocator> AllocTraits;
|
||||
typedef typename AllocTraits::pointer pointer;
|
||||
typedef typename AllocTraits::size_type size_type;
|
||||
typedef container_detail::integral_constant<unsigned,
|
||||
boost::container::container_detail::
|
||||
typedef dtl::integral_constant<unsigned,
|
||||
boost::container::dtl::
|
||||
version<Allocator>::value> alloc_version;
|
||||
|
||||
scoped_destroy_deallocator(pointer p, Allocator& a)
|
||||
@@ -152,7 +152,7 @@ struct scoped_destroy_deallocator
|
||||
~scoped_destroy_deallocator()
|
||||
{
|
||||
if(m_ptr){
|
||||
AllocTraits::destroy(m_alloc, container_detail::to_raw_pointer(m_ptr));
|
||||
AllocTraits::destroy(m_alloc, boost::movelib::to_raw_pointer(m_ptr));
|
||||
priv_deallocate(m_ptr, alloc_version());
|
||||
}
|
||||
}
|
||||
@@ -202,7 +202,7 @@ struct scoped_destructor_n
|
||||
~scoped_destructor_n()
|
||||
{
|
||||
if(!m_p) return;
|
||||
value_type *raw_ptr = container_detail::to_raw_pointer(m_p);
|
||||
value_type *raw_ptr = boost::movelib::to_raw_pointer(m_p);
|
||||
while(m_n--){
|
||||
AllocTraits::destroy(m_a, raw_ptr++);
|
||||
}
|
||||
@@ -270,12 +270,12 @@ class scoped_destructor
|
||||
};
|
||||
|
||||
|
||||
template<class Allocator>
|
||||
template<class Allocator, class Value = typename Allocator::value_type>
|
||||
class value_destructor
|
||||
{
|
||||
typedef boost::container::allocator_traits<Allocator> AllocTraits;
|
||||
public:
|
||||
typedef typename Allocator::value_type value_type;
|
||||
typedef Value value_type;
|
||||
value_destructor(Allocator &a, value_type &rv)
|
||||
: rv_(rv), a_(a)
|
||||
{}
|
||||
@@ -296,8 +296,8 @@ class allocator_destroyer
|
||||
typedef boost::container::allocator_traits<Allocator> AllocTraits;
|
||||
typedef typename AllocTraits::value_type value_type;
|
||||
typedef typename AllocTraits::pointer pointer;
|
||||
typedef container_detail::integral_constant<unsigned,
|
||||
boost::container::container_detail::
|
||||
typedef dtl::integral_constant<unsigned,
|
||||
boost::container::dtl::
|
||||
version<Allocator>::value> alloc_version;
|
||||
|
||||
private:
|
||||
@@ -317,7 +317,7 @@ class allocator_destroyer
|
||||
|
||||
void operator()(const pointer &p)
|
||||
{
|
||||
AllocTraits::destroy(a_, container_detail::to_raw_pointer(p));
|
||||
AllocTraits::destroy(a_, boost::movelib::to_raw_pointer(p));
|
||||
this->priv_deallocate(p, alloc_version());
|
||||
}
|
||||
};
|
||||
@@ -339,7 +339,7 @@ class allocator_destroyer_and_chain_builder
|
||||
|
||||
void operator()(const typename Allocator::pointer &p)
|
||||
{
|
||||
allocator_traits<Allocator>::destroy(a_, container_detail::to_raw_pointer(p));
|
||||
allocator_traits<Allocator>::destroy(a_, boost::movelib::to_raw_pointer(p));
|
||||
c_.push_back(p);
|
||||
}
|
||||
};
|
||||
@@ -369,7 +369,7 @@ class allocator_multialloc_chain_node_deallocator
|
||||
}
|
||||
};
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace boost { namespace container {
|
||||
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
|
||||
// Check if we can detect is_convertible using advanced SFINAE expressions
|
||||
@@ -110,10 +110,10 @@ template < typename ConstructAlloc
|
||||
, typename T
|
||||
, class ...Args
|
||||
>
|
||||
inline typename container_detail::enable_if_and
|
||||
inline typename dtl::enable_if_and
|
||||
< void
|
||||
, container_detail::is_not_pair<T>
|
||||
, container_detail::not_< uses_allocator<T, ArgAlloc> >
|
||||
, dtl::is_not_pair<T>
|
||||
, dtl::not_< uses_allocator<T, ArgAlloc> >
|
||||
>::type dispatch_uses_allocator
|
||||
( ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, T* p, BOOST_FWD_REF(Args)...args)
|
||||
{
|
||||
@@ -127,9 +127,9 @@ template < typename ConstructAlloc
|
||||
, typename T
|
||||
, class ...Args
|
||||
>
|
||||
inline typename container_detail::enable_if_and
|
||||
inline typename dtl::enable_if_and
|
||||
< void
|
||||
, container_detail::is_not_pair<T>
|
||||
, dtl::is_not_pair<T>
|
||||
, uses_allocator<T, ArgAlloc>
|
||||
, is_constructible_with_allocator_prefix<T, ArgAlloc, Args...>
|
||||
>::type dispatch_uses_allocator
|
||||
@@ -146,11 +146,11 @@ template < typename ConstructAlloc
|
||||
, typename T
|
||||
, class ...Args
|
||||
>
|
||||
inline typename container_detail::enable_if_and
|
||||
inline typename dtl::enable_if_and
|
||||
< void
|
||||
, container_detail::is_not_pair<T>
|
||||
, dtl::is_not_pair<T>
|
||||
, uses_allocator<T, ArgAlloc>
|
||||
, container_detail::not_<is_constructible_with_allocator_prefix<T, ArgAlloc, Args...> >
|
||||
, dtl::not_<is_constructible_with_allocator_prefix<T, ArgAlloc, Args...> >
|
||||
>::type dispatch_uses_allocator
|
||||
( ConstructAlloc& construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, T* p, BOOST_FWD_REF(Args)...args)
|
||||
{
|
||||
@@ -162,10 +162,10 @@ inline typename container_detail::enable_if_and
|
||||
|
||||
#define BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE(N) \
|
||||
template <typename ConstructAlloc, typename ArgAlloc, typename T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
|
||||
inline typename container_detail::enable_if_and\
|
||||
inline typename dtl::enable_if_and\
|
||||
< void\
|
||||
, container_detail::is_not_pair<T>\
|
||||
, container_detail::not_<uses_allocator<T, ArgAlloc> >\
|
||||
, dtl::is_not_pair<T>\
|
||||
, dtl::not_<uses_allocator<T, ArgAlloc> >\
|
||||
>::type\
|
||||
dispatch_uses_allocator\
|
||||
(ConstructAlloc &construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, T* p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
||||
@@ -179,9 +179,9 @@ BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR
|
||||
|
||||
#define BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE(N) \
|
||||
template < typename ConstructAlloc, typename ArgAlloc, typename T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
|
||||
inline typename container_detail::enable_if_and\
|
||||
inline typename dtl::enable_if_and\
|
||||
< void\
|
||||
, container_detail::is_not_pair<T>\
|
||||
, dtl::is_not_pair<T>\
|
||||
, uses_allocator<T, ArgAlloc>\
|
||||
, is_constructible_with_allocator_prefix<T, ArgAlloc BOOST_MOVE_I##N BOOST_MOVE_TARG##N>\
|
||||
>::type\
|
||||
@@ -197,11 +197,11 @@ BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR
|
||||
|
||||
#define BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE(N) \
|
||||
template < typename ConstructAlloc, typename ArgAlloc, typename T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
|
||||
inline typename container_detail::enable_if_and\
|
||||
inline typename dtl::enable_if_and\
|
||||
< void\
|
||||
, container_detail::is_not_pair<T>\
|
||||
, dtl::is_not_pair<T>\
|
||||
, uses_allocator<T, ArgAlloc>\
|
||||
, container_detail::not_<is_constructible_with_allocator_prefix<T, ArgAlloc BOOST_MOVE_I##N BOOST_MOVE_TARG##N> >\
|
||||
, dtl::not_<is_constructible_with_allocator_prefix<T, ArgAlloc BOOST_MOVE_I##N BOOST_MOVE_TARG##N> >\
|
||||
>::type\
|
||||
dispatch_uses_allocator\
|
||||
(ConstructAlloc& construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, T* p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
||||
@@ -219,18 +219,18 @@ template < typename ConstructAlloc
|
||||
, typename ArgAlloc
|
||||
, typename Pair
|
||||
> inline
|
||||
BOOST_CONTAINER_DOC1ST(void, typename container_detail::enable_if<container_detail::is_pair<Pair> >::type)
|
||||
BOOST_CONTAINER_DOC1ST(void, typename dtl::enable_if<dtl::is_pair<Pair> BOOST_MOVE_I void >::type)
|
||||
dispatch_uses_allocator
|
||||
( ConstructAlloc & construct_alloc
|
||||
, BOOST_FWD_REF(ArgAlloc) arg_alloc
|
||||
, Pair* p)
|
||||
{
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->first));
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->first));
|
||||
BOOST_TRY{
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->second));
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->second));
|
||||
}
|
||||
BOOST_CATCH(...) {
|
||||
allocator_traits<ConstructAlloc>::destroy(construct_alloc, container_detail::addressof(p->first));
|
||||
allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(p->first));
|
||||
BOOST_RETHROW
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
@@ -240,18 +240,18 @@ BOOST_CONTAINER_DOC1ST(void, typename container_detail::enable_if<container_deta
|
||||
template < typename ConstructAlloc
|
||||
, typename ArgAlloc
|
||||
, class Pair, class U, class V>
|
||||
BOOST_CONTAINER_DOC1ST(void, typename container_detail::enable_if<container_detail::is_pair<Pair> >::type)
|
||||
BOOST_CONTAINER_DOC1ST(void, typename dtl::enable_if<dtl::is_pair<Pair> BOOST_MOVE_I void>::type)
|
||||
dispatch_uses_allocator
|
||||
( ConstructAlloc & construct_alloc
|
||||
, BOOST_FWD_REF(ArgAlloc) arg_alloc
|
||||
, Pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y)
|
||||
{
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->first), ::boost::forward<U>(x));
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward<U>(x));
|
||||
BOOST_TRY{
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->second), ::boost::forward<V>(y));
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->second), ::boost::forward<V>(y));
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
allocator_traits<ConstructAlloc>::destroy(construct_alloc, container_detail::addressof(p->first));
|
||||
allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(p->first));
|
||||
BOOST_RETHROW
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
@@ -260,7 +260,7 @@ BOOST_CONTAINER_DOC1ST(void, typename container_detail::enable_if<container_deta
|
||||
template < typename ConstructAlloc
|
||||
, typename ArgAlloc
|
||||
, class Pair, class Pair2>
|
||||
BOOST_CONTAINER_DOC1ST(void, typename container_detail::enable_if< container_detail::is_pair<Pair> >::type)
|
||||
BOOST_CONTAINER_DOC1ST(void, typename dtl::enable_if< dtl::is_pair<Pair> BOOST_MOVE_I void >::type)
|
||||
dispatch_uses_allocator
|
||||
(ConstructAlloc & construct_alloc
|
||||
, BOOST_FWD_REF(ArgAlloc) arg_alloc
|
||||
@@ -270,10 +270,10 @@ BOOST_CONTAINER_DOC1ST(void, typename container_detail::enable_if< container_det
|
||||
template < typename ConstructAlloc
|
||||
, typename ArgAlloc
|
||||
, class Pair, class Pair2>
|
||||
typename container_detail::enable_if_and
|
||||
typename dtl::enable_if_and
|
||||
< void
|
||||
, container_detail::is_pair<Pair>
|
||||
, container_detail::not_<boost::move_detail::is_reference<Pair2> > >::type //This is needed for MSVC10 and ambiguous overloads
|
||||
, dtl::is_pair<Pair>
|
||||
, dtl::not_<boost::move_detail::is_reference<Pair2> > >::type //This is needed for MSVC10 and ambiguous overloads
|
||||
dispatch_uses_allocator
|
||||
(ConstructAlloc & construct_alloc
|
||||
, BOOST_FWD_REF(ArgAlloc) arg_alloc
|
||||
@@ -286,20 +286,20 @@ typename container_detail::enable_if_and
|
||||
template< typename ConstructAlloc, typename ArgAlloc, class Pair \
|
||||
, template<class, class, class, class, class, class, class, class, class, class> class BoostTuple \
|
||||
BOOST_MOVE_I_IF(BOOST_MOVE_OR(N,M)) BOOST_MOVE_CLASS##N BOOST_MOVE_I_IF(BOOST_MOVE_AND(N,M)) BOOST_MOVE_CLASSQ##M > \
|
||||
typename container_detail::enable_if< container_detail::is_pair<Pair> >::type\
|
||||
typename dtl::enable_if< dtl::is_pair<Pair> BOOST_MOVE_I void>::type\
|
||||
dispatch_uses_allocator( ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* pair, piecewise_construct_t\
|
||||
, BoostTuple<BOOST_MOVE_TARG##N BOOST_MOVE_I##N BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(10,N),::boost::tuples::null_type)> p\
|
||||
, BoostTuple<BOOST_MOVE_TARGQ##M BOOST_MOVE_I##M BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(10,M),::boost::tuples::null_type)> q)\
|
||||
{\
|
||||
(void)p; (void)q;\
|
||||
(dispatch_uses_allocator)\
|
||||
(construct_alloc, arg_alloc, container_detail::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_TMPL_GET##N);\
|
||||
(construct_alloc, arg_alloc, dtl::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_TMPL_GET##N);\
|
||||
BOOST_TRY{\
|
||||
(dispatch_uses_allocator)\
|
||||
(construct_alloc, arg_alloc, container_detail::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_TMPL_GETQ##M);\
|
||||
(construct_alloc, arg_alloc, dtl::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_TMPL_GETQ##M);\
|
||||
}\
|
||||
BOOST_CATCH(...) {\
|
||||
allocator_traits<ConstructAlloc>::destroy(construct_alloc, container_detail::addressof(pair->first));\
|
||||
allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(pair->first));\
|
||||
BOOST_RETHROW\
|
||||
}\
|
||||
BOOST_CATCH_END\
|
||||
@@ -317,12 +317,12 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO
|
||||
, Tuple<Args1...>& t1, Tuple<Args2...>& t2, index_tuple<Indexes1...>, index_tuple<Indexes2...>)
|
||||
{
|
||||
(void)t1; (void)t2;
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(pair->first), ::boost::forward<Args1>(get<Indexes1>(t1))...);
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(pair->first), ::boost::forward<Args1>(get<Indexes1>(t1))...);
|
||||
BOOST_TRY{
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(pair->second), ::boost::forward<Args2>(get<Indexes2>(t2))...);
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(pair->second), ::boost::forward<Args2>(get<Indexes2>(t2))...);
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
allocator_traits<ConstructAlloc>::destroy(construct_alloc, container_detail::addressof(pair->first));
|
||||
allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(pair->first));
|
||||
BOOST_RETHROW
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
@@ -330,7 +330,7 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO
|
||||
|
||||
template< typename ConstructAlloc, typename ArgAlloc, class Pair
|
||||
, template<class ...> class Tuple, class... Args1, class... Args2>
|
||||
typename container_detail::enable_if< container_detail::is_pair<Pair> >::type
|
||||
typename dtl::enable_if< dtl::is_pair<Pair>, void >::type
|
||||
dispatch_uses_allocator( ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* pair, piecewise_construct_t
|
||||
, Tuple<Args1...> t1, Tuple<Args2...> t2)
|
||||
{
|
||||
@@ -346,20 +346,20 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO
|
||||
template< typename ConstructAlloc, typename ArgAlloc, class Pair\
|
||||
, template<class, class, class, class, class, class, class, class, class, class> class StdTuple\
|
||||
BOOST_MOVE_I_IF(BOOST_MOVE_OR(N,M)) BOOST_MOVE_CLASS##N BOOST_MOVE_I_IF(BOOST_MOVE_AND(N,M)) BOOST_MOVE_CLASSQ##M > \
|
||||
typename container_detail::enable_if< container_detail::is_pair<Pair> >::type\
|
||||
typename dtl::enable_if< dtl::is_pair<Pair> BOOST_MOVE_I void>::type\
|
||||
dispatch_uses_allocator(ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* pair, piecewise_construct_t\
|
||||
, StdTuple<BOOST_MOVE_TARG##N BOOST_MOVE_I##N BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(10,N),::std::tr1::_Nil)> p\
|
||||
, StdTuple<BOOST_MOVE_TARGQ##M BOOST_MOVE_I##M BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(10,M),::std::tr1::_Nil)> q)\
|
||||
{\
|
||||
(void)p; (void)q;\
|
||||
(dispatch_uses_allocator)\
|
||||
(construct_alloc, arg_alloc, container_detail::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_GET_IDX##N);\
|
||||
(construct_alloc, arg_alloc, dtl::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_GET_IDX##N);\
|
||||
BOOST_TRY{\
|
||||
(dispatch_uses_allocator)\
|
||||
(construct_alloc, arg_alloc, container_detail::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_GET_IDXQ##M);\
|
||||
(construct_alloc, arg_alloc, dtl::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_GET_IDXQ##M);\
|
||||
}\
|
||||
BOOST_CATCH(...) {\
|
||||
allocator_traits<ConstructAlloc>::destroy(construct_alloc, container_detail::addressof(pair->first));\
|
||||
allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(pair->first));\
|
||||
BOOST_RETHROW\
|
||||
}\
|
||||
BOOST_CATCH_END\
|
||||
@@ -380,7 +380,7 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO
|
||||
template< typename ConstructAlloc, typename ArgAlloc, class Pair\
|
||||
, template<BOOST_MOVE_REPEAT(_VARIADIC_MAX, class), class, class, class> class StdTuple \
|
||||
BOOST_MOVE_I_IF(BOOST_MOVE_OR(N,M)) BOOST_MOVE_CLASS##N BOOST_MOVE_I_IF(BOOST_MOVE_AND(N,M)) BOOST_MOVE_CLASSQ##M > \
|
||||
typename container_detail::enable_if< container_detail::is_pair<Pair> >::type\
|
||||
typename dtl::enable_if< dtl::is_pair<Pair> BOOST_MOVE_I void>::type\
|
||||
dispatch_uses_allocator\
|
||||
( ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* pair, piecewise_construct_t\
|
||||
, StdTuple<BOOST_MOVE_TARG##N BOOST_MOVE_I##N BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(BOOST_MOVE_ADD(_VARIADIC_MAX, 3),N),::std::_Nil) > p\
|
||||
@@ -388,13 +388,13 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO
|
||||
{\
|
||||
(void)p; (void)q;\
|
||||
(dispatch_uses_allocator)\
|
||||
(construct_alloc, arg_alloc, container_detail::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_GET_IDX##N);\
|
||||
(construct_alloc, arg_alloc, dtl::addressof(pair->first) BOOST_MOVE_I_IF(N) BOOST_MOVE_GET_IDX##N);\
|
||||
BOOST_TRY{\
|
||||
(dispatch_uses_allocator)\
|
||||
(construct_alloc, arg_alloc, container_detail::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_GET_IDXQ##M);\
|
||||
(construct_alloc, arg_alloc, dtl::addressof(pair->second) BOOST_MOVE_I_IF(M) BOOST_MOVE_GET_IDXQ##M);\
|
||||
}\
|
||||
BOOST_CATCH(...) {\
|
||||
allocator_traits<ConstructAlloc>::destroy(construct_alloc, container_detail::addressof(pair->first));\
|
||||
allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(pair->first));\
|
||||
BOOST_RETHROW\
|
||||
}\
|
||||
BOOST_CATCH_END\
|
||||
@@ -411,16 +411,16 @@ BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_DISPATCH_USES_ALLOCATOR_PIECEWISE_CONSTRUCT_BO
|
||||
template < typename ConstructAlloc
|
||||
, typename ArgAlloc
|
||||
, class Pair, class KeyType, class ... Args>
|
||||
typename container_detail::enable_if< container_detail::is_pair<Pair>, void >::type
|
||||
typename dtl::enable_if< dtl::is_pair<Pair>, void >::type
|
||||
dispatch_uses_allocator
|
||||
(ConstructAlloc & construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* p, try_emplace_t, BOOST_FWD_REF(KeyType) k, BOOST_FWD_REF(Args) ...args)
|
||||
{
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->first), ::boost::forward<KeyType>(k));
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward<KeyType>(k));
|
||||
BOOST_TRY{
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->second), ::boost::forward<Args>(args)...);
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->second), ::boost::forward<Args>(args)...);
|
||||
}
|
||||
BOOST_CATCH(...) {
|
||||
allocator_traits<ConstructAlloc>::destroy(construct_alloc, container_detail::addressof(p->first));
|
||||
allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(p->first));
|
||||
BOOST_RETHROW
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
@@ -430,18 +430,18 @@ typename container_detail::enable_if< container_detail::is_pair<Pair>, void >::t
|
||||
|
||||
#define BOOST_CONTAINER_DISPATCH_USES_ALLOCATOR_PAIR_TRY_EMPLACE_CODE(N) \
|
||||
template <typename ConstructAlloc, typename ArgAlloc, class Pair, class KeyType BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
|
||||
inline typename container_detail::enable_if\
|
||||
< container_detail::is_pair<Pair>, void >::type\
|
||||
inline typename dtl::enable_if\
|
||||
< dtl::is_pair<Pair> BOOST_MOVE_I void >::type\
|
||||
dispatch_uses_allocator\
|
||||
(ConstructAlloc &construct_alloc, BOOST_FWD_REF(ArgAlloc) arg_alloc, Pair* p, try_emplace_t, \
|
||||
BOOST_FWD_REF(KeyType) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
|
||||
{\
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->first), ::boost::forward<KeyType>(k));\
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->first), ::boost::forward<KeyType>(k));\
|
||||
BOOST_TRY{\
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, container_detail::addressof(p->second) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
|
||||
(dispatch_uses_allocator)(construct_alloc, arg_alloc, dtl::addressof(p->second) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
|
||||
}\
|
||||
BOOST_CATCH(...) {\
|
||||
allocator_traits<ConstructAlloc>::destroy(construct_alloc, container_detail::addressof(p->first));\
|
||||
allocator_traits<ConstructAlloc>::destroy(construct_alloc, dtl::addressof(p->first));\
|
||||
BOOST_RETHROW\
|
||||
}\
|
||||
BOOST_CATCH_END\
|
||||
@@ -452,7 +452,7 @@ BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_DISPATCH_USES_ALLOCATOR_PAIR_TRY_EMPLACE
|
||||
|
||||
#endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
} //namespace container_detail
|
||||
} //namespace dtl
|
||||
|
||||
}} // namespace boost { namespace container {
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
62
linx64/include/boost/container/detail/is_container.hpp
Normal file
62
linx64/include/boost/container/detail/is_container.hpp
Normal file
@@ -0,0 +1,62 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2017-2017. 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_IS_CONTAINER_HPP
|
||||
#define BOOST_CONTAINER_DETAIL_IS_CONTAINER_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//empty
|
||||
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME empty
|
||||
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace is_container_detail {
|
||||
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}}
|
||||
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 0
|
||||
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 0
|
||||
#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
|
||||
|
||||
//size
|
||||
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME size
|
||||
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace is_container_detail {
|
||||
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}}
|
||||
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 0
|
||||
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 0
|
||||
#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace dtl {
|
||||
|
||||
template <class Container>
|
||||
struct is_container
|
||||
{
|
||||
static const bool value =
|
||||
boost::container::is_container_detail::
|
||||
has_member_function_callable_with_size <const Container>::value &&
|
||||
boost::container::is_container_detail::
|
||||
has_member_function_callable_with_empty<const Container>::value;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_container<void>
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
#endif //#ifndef BOOST_CONTAINER_DETAIL_IS_CONTAINER_HPP
|
||||
@@ -0,0 +1,47 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2017-2017. 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_IS_CONTIGUOUS_CONTAINER_HPP
|
||||
#define BOOST_CONTAINER_DETAIL_IS_CONTIGUOUS_CONTAINER_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//data
|
||||
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME data
|
||||
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace is_contiguous_container_detail {
|
||||
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}}
|
||||
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 0
|
||||
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 0
|
||||
#include <boost/intrusive/detail/has_member_function_callable_with.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace dtl {
|
||||
|
||||
template <class Container>
|
||||
struct is_contiguous_container
|
||||
{
|
||||
static const bool value =
|
||||
boost::container::is_contiguous_container_detail::
|
||||
has_member_function_callable_with_data<Container>::value &&
|
||||
boost::container::is_contiguous_container_detail::
|
||||
has_member_function_callable_with_data<const Container>::value;
|
||||
};
|
||||
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
#endif //#ifndef BOOST_CONTAINER_DETAIL_IS_CONTIGUOUS_CONTAINER_HPP
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
template <class ForwardIterator, class Pred>
|
||||
bool is_sorted (ForwardIterator first, ForwardIterator last, Pred pred)
|
||||
@@ -50,7 +50,7 @@ bool is_sorted_and_unique (ForwardIterator first, ForwardIterator last, Pred pre
|
||||
return true;
|
||||
}
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#endif
|
||||
|
||||
#include <boost/intrusive/detail/iterator.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
@@ -34,6 +36,50 @@ using ::boost::intrusive::iterator_enable_if_tag;
|
||||
using ::boost::intrusive::iterator_disable_if_tag;
|
||||
using ::boost::intrusive::iterator_arrow_result;
|
||||
|
||||
template <class Container>
|
||||
class back_emplacer
|
||||
{
|
||||
private:
|
||||
Container& container;
|
||||
|
||||
public:
|
||||
typedef std::output_iterator_tag iterator_category;
|
||||
typedef void value_type;
|
||||
typedef void difference_type;
|
||||
typedef void pointer;
|
||||
typedef void reference;
|
||||
|
||||
back_emplacer(Container& x)
|
||||
: container(x)
|
||||
{}
|
||||
|
||||
template<class U>
|
||||
back_emplacer& operator=(BOOST_FWD_REF(U) value)
|
||||
{
|
||||
container.emplace_back(boost::forward<U>(value));
|
||||
return *this;
|
||||
}
|
||||
back_emplacer& operator*() { return *this; }
|
||||
back_emplacer& operator++() { return *this; }
|
||||
back_emplacer& operator++(int){ return *this; }
|
||||
};
|
||||
|
||||
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
|
||||
|
||||
template<class InputIterator>
|
||||
using it_based_non_const_first_type_t = typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type;
|
||||
|
||||
template<class InputIterator>
|
||||
using it_based_const_first_type_t = const typename dtl::remove_const<typename iterator_traits<InputIterator>::value_type::first_type>::type;
|
||||
|
||||
template<class InputIterator>
|
||||
using it_based_second_type_t = typename iterator_traits<InputIterator>::value_type::second_type;
|
||||
|
||||
template<class InputIterator>
|
||||
using it_based_value_type_t = typename iterator_traits<InputIterator>::value_type;
|
||||
|
||||
#endif
|
||||
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -18,40 +18,15 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/container/detail/iterator.hpp>
|
||||
#include <boost/container/detail/to_raw_pointer.hpp>
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
#include <boost/move/detail/iterator_to_raw_pointer.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
template <class T>
|
||||
inline T* iterator_to_pointer(T* i)
|
||||
{ return i; }
|
||||
using ::boost::movelib::iterator_to_raw_pointer;
|
||||
|
||||
template <class Iterator>
|
||||
inline typename boost::container::iterator_traits<Iterator>::pointer
|
||||
iterator_to_pointer(const Iterator &i)
|
||||
{ return i.operator->(); }
|
||||
|
||||
template <class Iterator>
|
||||
struct iterator_to_element_ptr
|
||||
{
|
||||
typedef typename boost::container::iterator_traits<Iterator>::pointer pointer;
|
||||
typedef typename boost::intrusive::pointer_traits<pointer>::element_type element_type;
|
||||
typedef element_type* type;
|
||||
};
|
||||
|
||||
template <class Iterator>
|
||||
inline typename iterator_to_element_ptr<Iterator>::type
|
||||
iterator_to_raw_pointer(const Iterator &i)
|
||||
{
|
||||
return ::boost::intrusive::detail::to_raw_pointer
|
||||
( ::boost::container::container_detail::iterator_to_pointer(i) );
|
||||
}
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -49,106 +49,106 @@ class constant_iterator
|
||||
typedef constant_iterator<T, Difference> this_type;
|
||||
|
||||
public:
|
||||
explicit constant_iterator(const T &ref, Difference range_size)
|
||||
BOOST_CONTAINER_FORCEINLINE explicit constant_iterator(const T &ref, Difference range_size)
|
||||
: m_ptr(&ref), m_num(range_size){}
|
||||
|
||||
//Constructors
|
||||
constant_iterator()
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator()
|
||||
: m_ptr(0), m_num(0){}
|
||||
|
||||
constant_iterator& operator++()
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator& operator++()
|
||||
{ increment(); return *this; }
|
||||
|
||||
constant_iterator operator++(int)
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator operator++(int)
|
||||
{
|
||||
constant_iterator result (*this);
|
||||
increment();
|
||||
return result;
|
||||
}
|
||||
|
||||
constant_iterator& operator--()
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator& operator--()
|
||||
{ decrement(); return *this; }
|
||||
|
||||
constant_iterator operator--(int)
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator operator--(int)
|
||||
{
|
||||
constant_iterator result (*this);
|
||||
decrement();
|
||||
return result;
|
||||
}
|
||||
|
||||
friend bool operator== (const constant_iterator& i, const constant_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator== (const constant_iterator& i, const constant_iterator& i2)
|
||||
{ return i.equal(i2); }
|
||||
|
||||
friend bool operator!= (const constant_iterator& i, const constant_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const constant_iterator& i, const constant_iterator& i2)
|
||||
{ return !(i == i2); }
|
||||
|
||||
friend bool operator< (const constant_iterator& i, const constant_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator< (const constant_iterator& i, const constant_iterator& i2)
|
||||
{ return i.less(i2); }
|
||||
|
||||
friend bool operator> (const constant_iterator& i, const constant_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator> (const constant_iterator& i, const constant_iterator& i2)
|
||||
{ return i2 < i; }
|
||||
|
||||
friend bool operator<= (const constant_iterator& i, const constant_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const constant_iterator& i, const constant_iterator& i2)
|
||||
{ return !(i > i2); }
|
||||
|
||||
friend bool operator>= (const constant_iterator& i, const constant_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const constant_iterator& i, const constant_iterator& i2)
|
||||
{ return !(i < i2); }
|
||||
|
||||
friend Difference operator- (const constant_iterator& i, const constant_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend Difference operator- (const constant_iterator& i, const constant_iterator& i2)
|
||||
{ return i2.distance_to(i); }
|
||||
|
||||
//Arithmetic
|
||||
constant_iterator& operator+=(Difference off)
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator& operator+=(Difference off)
|
||||
{ this->advance(off); return *this; }
|
||||
|
||||
constant_iterator operator+(Difference off) const
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator operator+(Difference off) const
|
||||
{
|
||||
constant_iterator other(*this);
|
||||
other.advance(off);
|
||||
return other;
|
||||
}
|
||||
|
||||
friend constant_iterator operator+(Difference off, const constant_iterator& right)
|
||||
BOOST_CONTAINER_FORCEINLINE friend constant_iterator operator+(Difference off, const constant_iterator& right)
|
||||
{ return right + off; }
|
||||
|
||||
constant_iterator& operator-=(Difference off)
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator& operator-=(Difference off)
|
||||
{ this->advance(-off); return *this; }
|
||||
|
||||
constant_iterator operator-(Difference off) const
|
||||
BOOST_CONTAINER_FORCEINLINE constant_iterator operator-(Difference off) const
|
||||
{ return *this + (-off); }
|
||||
|
||||
const T& operator*() const
|
||||
BOOST_CONTAINER_FORCEINLINE const T& operator*() const
|
||||
{ return dereference(); }
|
||||
|
||||
const T& operator[] (Difference ) const
|
||||
BOOST_CONTAINER_FORCEINLINE const T& operator[] (Difference ) const
|
||||
{ return dereference(); }
|
||||
|
||||
const T* operator->() const
|
||||
BOOST_CONTAINER_FORCEINLINE const T* operator->() const
|
||||
{ return &(dereference()); }
|
||||
|
||||
private:
|
||||
const T * m_ptr;
|
||||
Difference m_num;
|
||||
|
||||
void increment()
|
||||
BOOST_CONTAINER_FORCEINLINE void increment()
|
||||
{ --m_num; }
|
||||
|
||||
void decrement()
|
||||
BOOST_CONTAINER_FORCEINLINE void decrement()
|
||||
{ ++m_num; }
|
||||
|
||||
bool equal(const this_type &other) const
|
||||
BOOST_CONTAINER_FORCEINLINE bool equal(const this_type &other) const
|
||||
{ return m_num == other.m_num; }
|
||||
|
||||
bool less(const this_type &other) const
|
||||
BOOST_CONTAINER_FORCEINLINE bool less(const this_type &other) const
|
||||
{ return other.m_num < m_num; }
|
||||
|
||||
const T & dereference() const
|
||||
BOOST_CONTAINER_FORCEINLINE const T & dereference() const
|
||||
{ return *m_ptr; }
|
||||
|
||||
void advance(Difference n)
|
||||
BOOST_CONTAINER_FORCEINLINE void advance(Difference n)
|
||||
{ m_num -= n; }
|
||||
|
||||
Difference distance_to(const this_type &other)const
|
||||
BOOST_CONTAINER_FORCEINLINE Difference distance_to(const this_type &other)const
|
||||
{ return m_num - other.m_num; }
|
||||
};
|
||||
|
||||
@@ -160,72 +160,72 @@ class value_init_construct_iterator
|
||||
typedef value_init_construct_iterator<T, Difference> this_type;
|
||||
|
||||
public:
|
||||
explicit value_init_construct_iterator(Difference range_size)
|
||||
BOOST_CONTAINER_FORCEINLINE explicit value_init_construct_iterator(Difference range_size)
|
||||
: m_num(range_size){}
|
||||
|
||||
//Constructors
|
||||
value_init_construct_iterator()
|
||||
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator()
|
||||
: m_num(0){}
|
||||
|
||||
value_init_construct_iterator& operator++()
|
||||
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator++()
|
||||
{ increment(); return *this; }
|
||||
|
||||
value_init_construct_iterator operator++(int)
|
||||
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator++(int)
|
||||
{
|
||||
value_init_construct_iterator result (*this);
|
||||
increment();
|
||||
return result;
|
||||
}
|
||||
|
||||
value_init_construct_iterator& operator--()
|
||||
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator--()
|
||||
{ decrement(); return *this; }
|
||||
|
||||
value_init_construct_iterator operator--(int)
|
||||
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator--(int)
|
||||
{
|
||||
value_init_construct_iterator result (*this);
|
||||
decrement();
|
||||
return result;
|
||||
}
|
||||
|
||||
friend bool operator== (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator== (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
|
||||
{ return i.equal(i2); }
|
||||
|
||||
friend bool operator!= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
|
||||
{ return !(i == i2); }
|
||||
|
||||
friend bool operator< (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator< (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
|
||||
{ return i.less(i2); }
|
||||
|
||||
friend bool operator> (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator> (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
|
||||
{ return i2 < i; }
|
||||
|
||||
friend bool operator<= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
|
||||
{ return !(i > i2); }
|
||||
|
||||
friend bool operator>= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
|
||||
{ return !(i < i2); }
|
||||
|
||||
friend Difference operator- (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend Difference operator- (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
|
||||
{ return i2.distance_to(i); }
|
||||
|
||||
//Arithmetic
|
||||
value_init_construct_iterator& operator+=(Difference off)
|
||||
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator+=(Difference off)
|
||||
{ this->advance(off); return *this; }
|
||||
|
||||
value_init_construct_iterator operator+(Difference off) const
|
||||
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator+(Difference off) const
|
||||
{
|
||||
value_init_construct_iterator other(*this);
|
||||
other.advance(off);
|
||||
return other;
|
||||
}
|
||||
|
||||
friend value_init_construct_iterator operator+(Difference off, const value_init_construct_iterator& right)
|
||||
BOOST_CONTAINER_FORCEINLINE friend value_init_construct_iterator operator+(Difference off, const value_init_construct_iterator& right)
|
||||
{ return right + off; }
|
||||
|
||||
value_init_construct_iterator& operator-=(Difference off)
|
||||
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator-=(Difference off)
|
||||
{ this->advance(-off); return *this; }
|
||||
|
||||
value_init_construct_iterator operator-(Difference off) const
|
||||
BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator-(Difference off) const
|
||||
{ return *this + (-off); }
|
||||
|
||||
//This pseudo-iterator's dereference operations have no sense since value is not
|
||||
@@ -238,28 +238,28 @@ class value_init_construct_iterator
|
||||
private:
|
||||
Difference m_num;
|
||||
|
||||
void increment()
|
||||
BOOST_CONTAINER_FORCEINLINE void increment()
|
||||
{ --m_num; }
|
||||
|
||||
void decrement()
|
||||
BOOST_CONTAINER_FORCEINLINE void decrement()
|
||||
{ ++m_num; }
|
||||
|
||||
bool equal(const this_type &other) const
|
||||
BOOST_CONTAINER_FORCEINLINE bool equal(const this_type &other) const
|
||||
{ return m_num == other.m_num; }
|
||||
|
||||
bool less(const this_type &other) const
|
||||
BOOST_CONTAINER_FORCEINLINE bool less(const this_type &other) const
|
||||
{ return other.m_num < m_num; }
|
||||
|
||||
const T & dereference() const
|
||||
BOOST_CONTAINER_FORCEINLINE const T & dereference() const
|
||||
{
|
||||
static T dummy;
|
||||
return dummy;
|
||||
}
|
||||
|
||||
void advance(Difference n)
|
||||
BOOST_CONTAINER_FORCEINLINE void advance(Difference n)
|
||||
{ m_num -= n; }
|
||||
|
||||
Difference distance_to(const this_type &other)const
|
||||
BOOST_CONTAINER_FORCEINLINE Difference distance_to(const this_type &other)const
|
||||
{ return m_num - other.m_num; }
|
||||
};
|
||||
|
||||
@@ -271,72 +271,72 @@ class default_init_construct_iterator
|
||||
typedef default_init_construct_iterator<T, Difference> this_type;
|
||||
|
||||
public:
|
||||
explicit default_init_construct_iterator(Difference range_size)
|
||||
BOOST_CONTAINER_FORCEINLINE explicit default_init_construct_iterator(Difference range_size)
|
||||
: m_num(range_size){}
|
||||
|
||||
//Constructors
|
||||
default_init_construct_iterator()
|
||||
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator()
|
||||
: m_num(0){}
|
||||
|
||||
default_init_construct_iterator& operator++()
|
||||
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator++()
|
||||
{ increment(); return *this; }
|
||||
|
||||
default_init_construct_iterator operator++(int)
|
||||
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator++(int)
|
||||
{
|
||||
default_init_construct_iterator result (*this);
|
||||
increment();
|
||||
return result;
|
||||
}
|
||||
|
||||
default_init_construct_iterator& operator--()
|
||||
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator--()
|
||||
{ decrement(); return *this; }
|
||||
|
||||
default_init_construct_iterator operator--(int)
|
||||
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator--(int)
|
||||
{
|
||||
default_init_construct_iterator result (*this);
|
||||
decrement();
|
||||
return result;
|
||||
}
|
||||
|
||||
friend bool operator== (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator== (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
|
||||
{ return i.equal(i2); }
|
||||
|
||||
friend bool operator!= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
|
||||
{ return !(i == i2); }
|
||||
|
||||
friend bool operator< (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator< (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
|
||||
{ return i.less(i2); }
|
||||
|
||||
friend bool operator> (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator> (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
|
||||
{ return i2 < i; }
|
||||
|
||||
friend bool operator<= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
|
||||
{ return !(i > i2); }
|
||||
|
||||
friend bool operator>= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
|
||||
{ return !(i < i2); }
|
||||
|
||||
friend Difference operator- (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend Difference operator- (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
|
||||
{ return i2.distance_to(i); }
|
||||
|
||||
//Arithmetic
|
||||
default_init_construct_iterator& operator+=(Difference off)
|
||||
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator+=(Difference off)
|
||||
{ this->advance(off); return *this; }
|
||||
|
||||
default_init_construct_iterator operator+(Difference off) const
|
||||
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator+(Difference off) const
|
||||
{
|
||||
default_init_construct_iterator other(*this);
|
||||
other.advance(off);
|
||||
return other;
|
||||
}
|
||||
|
||||
friend default_init_construct_iterator operator+(Difference off, const default_init_construct_iterator& right)
|
||||
BOOST_CONTAINER_FORCEINLINE friend default_init_construct_iterator operator+(Difference off, const default_init_construct_iterator& right)
|
||||
{ return right + off; }
|
||||
|
||||
default_init_construct_iterator& operator-=(Difference off)
|
||||
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator-=(Difference off)
|
||||
{ this->advance(-off); return *this; }
|
||||
|
||||
default_init_construct_iterator operator-(Difference off) const
|
||||
BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator-(Difference off) const
|
||||
{ return *this + (-off); }
|
||||
|
||||
//This pseudo-iterator's dereference operations have no sense since value is not
|
||||
@@ -349,28 +349,28 @@ class default_init_construct_iterator
|
||||
private:
|
||||
Difference m_num;
|
||||
|
||||
void increment()
|
||||
BOOST_CONTAINER_FORCEINLINE void increment()
|
||||
{ --m_num; }
|
||||
|
||||
void decrement()
|
||||
BOOST_CONTAINER_FORCEINLINE void decrement()
|
||||
{ ++m_num; }
|
||||
|
||||
bool equal(const this_type &other) const
|
||||
BOOST_CONTAINER_FORCEINLINE bool equal(const this_type &other) const
|
||||
{ return m_num == other.m_num; }
|
||||
|
||||
bool less(const this_type &other) const
|
||||
BOOST_CONTAINER_FORCEINLINE bool less(const this_type &other) const
|
||||
{ return other.m_num < m_num; }
|
||||
|
||||
const T & dereference() const
|
||||
BOOST_CONTAINER_FORCEINLINE const T & dereference() const
|
||||
{
|
||||
static T dummy;
|
||||
return dummy;
|
||||
}
|
||||
|
||||
void advance(Difference n)
|
||||
BOOST_CONTAINER_FORCEINLINE void advance(Difference n)
|
||||
{ m_num -= n; }
|
||||
|
||||
Difference distance_to(const this_type &other)const
|
||||
BOOST_CONTAINER_FORCEINLINE Difference distance_to(const this_type &other) const
|
||||
{ return m_num - other.m_num; }
|
||||
};
|
||||
|
||||
@@ -382,106 +382,106 @@ class repeat_iterator
|
||||
{
|
||||
typedef repeat_iterator<T, Difference> this_type;
|
||||
public:
|
||||
explicit repeat_iterator(T &ref, Difference range_size)
|
||||
BOOST_CONTAINER_FORCEINLINE explicit repeat_iterator(T &ref, Difference range_size)
|
||||
: m_ptr(&ref), m_num(range_size){}
|
||||
|
||||
//Constructors
|
||||
repeat_iterator()
|
||||
BOOST_CONTAINER_FORCEINLINE repeat_iterator()
|
||||
: m_ptr(0), m_num(0){}
|
||||
|
||||
this_type& operator++()
|
||||
BOOST_CONTAINER_FORCEINLINE this_type& operator++()
|
||||
{ increment(); return *this; }
|
||||
|
||||
this_type operator++(int)
|
||||
BOOST_CONTAINER_FORCEINLINE this_type operator++(int)
|
||||
{
|
||||
this_type result (*this);
|
||||
increment();
|
||||
return result;
|
||||
}
|
||||
|
||||
this_type& operator--()
|
||||
BOOST_CONTAINER_FORCEINLINE this_type& operator--()
|
||||
{ increment(); return *this; }
|
||||
|
||||
this_type operator--(int)
|
||||
BOOST_CONTAINER_FORCEINLINE this_type operator--(int)
|
||||
{
|
||||
this_type result (*this);
|
||||
increment();
|
||||
return result;
|
||||
}
|
||||
|
||||
friend bool operator== (const this_type& i, const this_type& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator== (const this_type& i, const this_type& i2)
|
||||
{ return i.equal(i2); }
|
||||
|
||||
friend bool operator!= (const this_type& i, const this_type& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const this_type& i, const this_type& i2)
|
||||
{ return !(i == i2); }
|
||||
|
||||
friend bool operator< (const this_type& i, const this_type& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator< (const this_type& i, const this_type& i2)
|
||||
{ return i.less(i2); }
|
||||
|
||||
friend bool operator> (const this_type& i, const this_type& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator> (const this_type& i, const this_type& i2)
|
||||
{ return i2 < i; }
|
||||
|
||||
friend bool operator<= (const this_type& i, const this_type& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const this_type& i, const this_type& i2)
|
||||
{ return !(i > i2); }
|
||||
|
||||
friend bool operator>= (const this_type& i, const this_type& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const this_type& i, const this_type& i2)
|
||||
{ return !(i < i2); }
|
||||
|
||||
friend Difference operator- (const this_type& i, const this_type& i2)
|
||||
BOOST_CONTAINER_FORCEINLINE friend Difference operator- (const this_type& i, const this_type& i2)
|
||||
{ return i2.distance_to(i); }
|
||||
|
||||
//Arithmetic
|
||||
this_type& operator+=(Difference off)
|
||||
BOOST_CONTAINER_FORCEINLINE this_type& operator+=(Difference off)
|
||||
{ this->advance(off); return *this; }
|
||||
|
||||
this_type operator+(Difference off) const
|
||||
BOOST_CONTAINER_FORCEINLINE this_type operator+(Difference off) const
|
||||
{
|
||||
this_type other(*this);
|
||||
other.advance(off);
|
||||
return other;
|
||||
}
|
||||
|
||||
friend this_type operator+(Difference off, const this_type& right)
|
||||
BOOST_CONTAINER_FORCEINLINE friend this_type operator+(Difference off, const this_type& right)
|
||||
{ return right + off; }
|
||||
|
||||
this_type& operator-=(Difference off)
|
||||
BOOST_CONTAINER_FORCEINLINE this_type& operator-=(Difference off)
|
||||
{ this->advance(-off); return *this; }
|
||||
|
||||
this_type operator-(Difference off) const
|
||||
BOOST_CONTAINER_FORCEINLINE this_type operator-(Difference off) const
|
||||
{ return *this + (-off); }
|
||||
|
||||
T& operator*() const
|
||||
BOOST_CONTAINER_FORCEINLINE T& operator*() const
|
||||
{ return dereference(); }
|
||||
|
||||
T& operator[] (Difference ) const
|
||||
BOOST_CONTAINER_FORCEINLINE T& operator[] (Difference ) const
|
||||
{ return dereference(); }
|
||||
|
||||
T *operator->() const
|
||||
BOOST_CONTAINER_FORCEINLINE T *operator->() const
|
||||
{ return &(dereference()); }
|
||||
|
||||
private:
|
||||
T * m_ptr;
|
||||
Difference m_num;
|
||||
|
||||
void increment()
|
||||
BOOST_CONTAINER_FORCEINLINE void increment()
|
||||
{ --m_num; }
|
||||
|
||||
void decrement()
|
||||
BOOST_CONTAINER_FORCEINLINE void decrement()
|
||||
{ ++m_num; }
|
||||
|
||||
bool equal(const this_type &other) const
|
||||
BOOST_CONTAINER_FORCEINLINE bool equal(const this_type &other) const
|
||||
{ return m_num == other.m_num; }
|
||||
|
||||
bool less(const this_type &other) const
|
||||
BOOST_CONTAINER_FORCEINLINE bool less(const this_type &other) const
|
||||
{ return other.m_num < m_num; }
|
||||
|
||||
T & dereference() const
|
||||
BOOST_CONTAINER_FORCEINLINE T & dereference() const
|
||||
{ return *m_ptr; }
|
||||
|
||||
void advance(Difference n)
|
||||
BOOST_CONTAINER_FORCEINLINE void advance(Difference n)
|
||||
{ m_num -= n; }
|
||||
|
||||
Difference distance_to(const this_type &other)const
|
||||
BOOST_CONTAINER_FORCEINLINE Difference distance_to(const this_type &other)const
|
||||
{ return m_num - other.m_num; }
|
||||
};
|
||||
|
||||
@@ -503,7 +503,7 @@ class emplace_iterator
|
||||
BOOST_CONTAINER_FORCEINLINE this_type& operator++()
|
||||
{ increment(); return *this; }
|
||||
|
||||
this_type operator++(int)
|
||||
BOOST_CONTAINER_FORCEINLINE this_type operator++(int)
|
||||
{
|
||||
this_type result (*this);
|
||||
increment();
|
||||
@@ -513,7 +513,7 @@ class emplace_iterator
|
||||
BOOST_CONTAINER_FORCEINLINE this_type& operator--()
|
||||
{ decrement(); return *this; }
|
||||
|
||||
this_type operator--(int)
|
||||
BOOST_CONTAINER_FORCEINLINE this_type operator--(int)
|
||||
{
|
||||
this_type result (*this);
|
||||
decrement();
|
||||
@@ -545,7 +545,7 @@ class emplace_iterator
|
||||
BOOST_CONTAINER_FORCEINLINE this_type& operator+=(difference_type off)
|
||||
{ this->advance(off); return *this; }
|
||||
|
||||
this_type operator+(difference_type off) const
|
||||
BOOST_CONTAINER_FORCEINLINE this_type operator+(difference_type off) const
|
||||
{
|
||||
this_type other(*this);
|
||||
other.advance(off);
|
||||
@@ -571,11 +571,11 @@ class emplace_iterator
|
||||
|
||||
public:
|
||||
template<class Allocator>
|
||||
void construct_in_place(Allocator &a, T* ptr)
|
||||
BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T* ptr)
|
||||
{ (*m_pe)(a, ptr); }
|
||||
|
||||
template<class DestIt>
|
||||
void assign_in_place(DestIt dest)
|
||||
BOOST_CONTAINER_FORCEINLINE void assign_in_place(DestIt dest)
|
||||
{ (*m_pe)(dest); }
|
||||
|
||||
private:
|
||||
@@ -612,9 +612,9 @@ class emplace_iterator
|
||||
template<class ...Args>
|
||||
struct emplace_functor
|
||||
{
|
||||
typedef typename container_detail::build_number_seq<sizeof...(Args)>::type index_tuple_t;
|
||||
typedef typename dtl::build_number_seq<sizeof...(Args)>::type index_tuple_t;
|
||||
|
||||
emplace_functor(BOOST_FWD_REF(Args)... args)
|
||||
BOOST_CONTAINER_FORCEINLINE emplace_functor(BOOST_FWD_REF(Args)... args)
|
||||
: args_(args...)
|
||||
{}
|
||||
|
||||
@@ -628,21 +628,21 @@ struct emplace_functor
|
||||
|
||||
private:
|
||||
template<class Allocator, class T, std::size_t ...IdxPack>
|
||||
BOOST_CONTAINER_FORCEINLINE void inplace_impl(Allocator &a, T* ptr, const container_detail::index_tuple<IdxPack...>&)
|
||||
BOOST_CONTAINER_FORCEINLINE void inplace_impl(Allocator &a, T* ptr, const dtl::index_tuple<IdxPack...>&)
|
||||
{
|
||||
allocator_traits<Allocator>::construct
|
||||
(a, ptr, ::boost::forward<Args>(container_detail::get<IdxPack>(args_))...);
|
||||
(a, ptr, ::boost::forward<Args>(dtl::get<IdxPack>(args_))...);
|
||||
}
|
||||
|
||||
template<class DestIt, std::size_t ...IdxPack>
|
||||
BOOST_CONTAINER_FORCEINLINE void inplace_impl(DestIt dest, const container_detail::index_tuple<IdxPack...>&)
|
||||
BOOST_CONTAINER_FORCEINLINE void inplace_impl(DestIt dest, const dtl::index_tuple<IdxPack...>&)
|
||||
{
|
||||
typedef typename boost::container::iterator_traits<DestIt>::value_type value_type;
|
||||
value_type && tmp= value_type(::boost::forward<Args>(container_detail::get<IdxPack>(args_))...);
|
||||
value_type && tmp= value_type(::boost::forward<Args>(dtl::get<IdxPack>(args_))...);
|
||||
*dest = ::boost::move(tmp);
|
||||
}
|
||||
|
||||
container_detail::tuple<Args&...> args_;
|
||||
dtl::tuple<Args&...> args_;
|
||||
};
|
||||
|
||||
template<class ...Args>
|
||||
@@ -661,18 +661,18 @@ struct emplace_functor_type;
|
||||
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
|
||||
struct emplace_functor##N\
|
||||
{\
|
||||
explicit emplace_functor##N( BOOST_MOVE_UREF##N )\
|
||||
BOOST_CONTAINER_FORCEINLINE explicit emplace_functor##N( BOOST_MOVE_UREF##N )\
|
||||
BOOST_MOVE_COLON##N BOOST_MOVE_FWD_INIT##N{}\
|
||||
\
|
||||
template<class Allocator, class T>\
|
||||
void operator()(Allocator &a, T *ptr)\
|
||||
BOOST_CONTAINER_FORCEINLINE void operator()(Allocator &a, T *ptr)\
|
||||
{ allocator_traits<Allocator>::construct(a, ptr BOOST_MOVE_I##N BOOST_MOVE_MFWD##N); }\
|
||||
\
|
||||
template<class DestIt>\
|
||||
void operator()(DestIt dest)\
|
||||
BOOST_CONTAINER_FORCEINLINE void operator()(DestIt dest)\
|
||||
{\
|
||||
typedef typename boost::container::iterator_traits<DestIt>::value_type value_type;\
|
||||
BOOST_MOVE_IF(N, value_type tmp(BOOST_MOVE_MFWD##N), container_detail::value_init<value_type> tmp) ;\
|
||||
BOOST_MOVE_IF(N, value_type tmp(BOOST_MOVE_MFWD##N), dtl::value_init<value_type> tmp) ;\
|
||||
*dest = ::boost::move(const_cast<value_type &>(BOOST_MOVE_IF(N, tmp, tmp.get())));\
|
||||
}\
|
||||
\
|
||||
@@ -692,7 +692,7 @@ BOOST_MOVE_ITERATE_0TO9(BOOST_MOVE_ITERATOR_EMPLACE_FUNCTOR_CODE)
|
||||
|
||||
#endif
|
||||
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
template<class T>
|
||||
struct has_iterator_category
|
||||
@@ -799,7 +799,16 @@ struct iterator_types<IIterator, false>
|
||||
template<class IIterator, bool IsConst>
|
||||
class iterator_from_iiterator
|
||||
{
|
||||
typedef typename iterator_types<IIterator, IsConst>::type types_t;
|
||||
typedef typename iterator_types<IIterator, IsConst>::type types_t;
|
||||
class nat
|
||||
{
|
||||
public:
|
||||
IIterator get() const
|
||||
{ return IIterator(); }
|
||||
};
|
||||
typedef typename dtl::if_c< IsConst
|
||||
, iterator_from_iiterator<IIterator, false>
|
||||
, nat>::type nonconst_iterator;
|
||||
|
||||
public:
|
||||
typedef typename types_t::pointer pointer;
|
||||
@@ -816,10 +825,17 @@ class iterator_from_iiterator
|
||||
: m_iit(iit)
|
||||
{}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator(iterator_from_iiterator<IIterator, false> const& other) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator(const iterator_from_iiterator& other) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
: m_iit(other.get())
|
||||
{}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator(const nonconst_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
: m_iit(other.get())
|
||||
{}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator& operator=(const iterator_from_iiterator& other) BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ m_iit = other.get(); return *this; }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{ ++this->m_iit; return *this; }
|
||||
|
||||
@@ -863,7 +879,7 @@ class iterator_from_iiterator
|
||||
IIterator m_iit;
|
||||
};
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
|
||||
using ::boost::intrusive::reverse_iterator;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
// Greatest common divisor and least common multiple
|
||||
|
||||
@@ -94,6 +94,34 @@ inline Integer upper_power_of_2(const Integer & A)
|
||||
return power_of_2;
|
||||
}
|
||||
|
||||
template <typename Integer, bool Loop = true>
|
||||
struct upper_power_of_2_loop_ct
|
||||
{
|
||||
|
||||
template <Integer I, Integer P>
|
||||
struct apply
|
||||
{
|
||||
static const Integer value =
|
||||
upper_power_of_2_loop_ct<Integer, (I > P*2)>::template apply<I, P*2>::value;
|
||||
};
|
||||
};
|
||||
|
||||
template <typename Integer>
|
||||
struct upper_power_of_2_loop_ct<Integer, false>
|
||||
{
|
||||
template <Integer I, Integer P>
|
||||
struct apply
|
||||
{
|
||||
static const Integer value = P;
|
||||
};
|
||||
};
|
||||
|
||||
template <typename Integer, Integer I>
|
||||
struct upper_power_of_2_ct
|
||||
{
|
||||
static const Integer value = upper_power_of_2_loop_ct<Integer, (I > 1)>::template apply<I, 2>::value;
|
||||
};
|
||||
|
||||
//This function uses binary search to discover the
|
||||
//highest set bit of the integer
|
||||
inline std::size_t floor_log2 (std::size_t x)
|
||||
@@ -114,7 +142,33 @@ inline std::size_t floor_log2 (std::size_t x)
|
||||
return log2;
|
||||
}
|
||||
|
||||
} // namespace container_detail
|
||||
template<std::size_t I1, std::size_t I2>
|
||||
struct gcd_ct
|
||||
{
|
||||
static const std::size_t Max = I1 > I2 ? I1 : I2;
|
||||
static const std::size_t Min = I1 < I2 ? I1 : I2;
|
||||
static const std::size_t value = gcd_ct<Min, Max % Min>::value;
|
||||
};
|
||||
|
||||
template<std::size_t I1>
|
||||
struct gcd_ct<I1, 0>
|
||||
{
|
||||
static const std::size_t value = I1;
|
||||
};
|
||||
|
||||
template<std::size_t I1>
|
||||
struct gcd_ct<0, I1>
|
||||
{
|
||||
static const std::size_t value = I1;
|
||||
};
|
||||
|
||||
template<std::size_t I1, std::size_t I2>
|
||||
struct lcm_ct
|
||||
{
|
||||
static const std::size_t value = I1 * I2 / gcd_ct<I1, I2>::value;
|
||||
};
|
||||
|
||||
} // namespace dtl
|
||||
} // namespace container
|
||||
} // namespace boost
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
template<class T>
|
||||
const T &max_value(const T &a, const T &b)
|
||||
@@ -30,7 +30,7 @@ template<class T>
|
||||
const T &min_value(const T &a, const T &b)
|
||||
{ return a < b ? a : b; }
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
using boost::move_detail::integral_constant;
|
||||
using boost::move_detail::true_type;
|
||||
@@ -61,6 +61,7 @@ using boost::move_detail::enable_if_and;
|
||||
using boost::move_detail::disable_if_and;
|
||||
using boost::move_detail::enable_if_or;
|
||||
using boost::move_detail::disable_if_or;
|
||||
using boost::move_detail::remove_const;
|
||||
|
||||
template <class FirstType>
|
||||
struct select1st
|
||||
@@ -76,7 +77,64 @@ struct select1st
|
||||
{ return const_cast<type&>(x.first); }
|
||||
};
|
||||
|
||||
} //namespace container_detail {
|
||||
|
||||
template<typename T>
|
||||
struct void_t { typedef void type; };
|
||||
|
||||
template <class T, class=void>
|
||||
struct is_transparent_base
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_transparent_base<T, typename void_t<typename T::is_transparent>::type>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_transparent
|
||||
: is_transparent_base<T>
|
||||
{};
|
||||
|
||||
template <typename C, class /*Dummy*/, typename R>
|
||||
struct enable_if_transparent
|
||||
: boost::move_detail::enable_if_c<dtl::is_transparent<C>::value, R>
|
||||
{};
|
||||
|
||||
#ifndef BOOST_CONTAINER_NO_CXX17_CTAD
|
||||
|
||||
// void_t (void_t for C++11)
|
||||
template<typename...> using variadic_void_t = void;
|
||||
|
||||
// Trait to detect Allocator-like types.
|
||||
template<typename Allocator, typename = void>
|
||||
struct is_allocator
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
T&& ctad_declval();
|
||||
|
||||
template<typename Allocator>
|
||||
struct is_allocator < Allocator,
|
||||
variadic_void_t< typename Allocator::value_type
|
||||
, decltype(ctad_declval<Allocator&>().allocate(size_t{})) >>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
using require_allocator_t = typename enable_if_c<is_allocator<T>::value, T>::type;
|
||||
|
||||
template<class T>
|
||||
using require_nonallocator_t = typename enable_if_c<!is_allocator<T>::value, T>::type;
|
||||
|
||||
#endif
|
||||
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// container
|
||||
#include <boost/container/container_fwd.hpp>
|
||||
// container/detail
|
||||
#include <boost/container/detail/to_raw_pointer.hpp>
|
||||
#include <boost/move/detail/to_raw_pointer.hpp>
|
||||
#include <boost/container/detail/transform_iterator.hpp>
|
||||
#include <boost/container/detail/type_traits.hpp>
|
||||
// intrusive
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
template<class VoidPointer>
|
||||
class basic_multiallocation_chain
|
||||
@@ -53,7 +53,7 @@ class basic_multiallocation_chain
|
||||
typedef bi::slist< node
|
||||
, bi::linear<true>
|
||||
, bi::cache_last<true>
|
||||
, bi::size_type<typename boost::container::container_detail::make_unsigned<difference_type>::type>
|
||||
, bi::size_type<typename boost::container::dtl::make_unsigned<difference_type>::type>
|
||||
> slist_impl_t;
|
||||
slist_impl_t slist_impl_;
|
||||
|
||||
@@ -63,7 +63,7 @@ class basic_multiallocation_chain
|
||||
pointer_traits<node_ptr> node_ptr_traits;
|
||||
|
||||
static node & to_node(const VoidPointer &p)
|
||||
{ return *static_cast<node*>(static_cast<void*>(container_detail::to_raw_pointer(p))); }
|
||||
{ return *static_cast<node*>(static_cast<void*>(boost::movelib::to_raw_pointer(p))); }
|
||||
|
||||
static VoidPointer from_node(node &n)
|
||||
{ return node_ptr_traits::pointer_to(n); }
|
||||
@@ -152,7 +152,7 @@ class basic_multiallocation_chain
|
||||
char_ptr prev_elem = elem;
|
||||
elem += unit_bytes;
|
||||
for(size_type i = 0; i != num_units-1; ++i, elem += unit_bytes){
|
||||
::new (container_detail::to_raw_pointer(prev_elem)) void_pointer(elem);
|
||||
::new (boost::movelib::to_raw_pointer(prev_elem)) void_pointer(elem);
|
||||
prev_elem = elem;
|
||||
}
|
||||
slist_impl_.incorporate_after(after_this, to_node_ptr(b), to_node_ptr(prev_elem), num_units);
|
||||
@@ -171,18 +171,23 @@ class basic_multiallocation_chain
|
||||
|
||||
std::pair<void_pointer, void_pointer> extract_data()
|
||||
{
|
||||
std::pair<void_pointer, void_pointer> ret
|
||||
(slist_impl_.begin().operator->()
|
||||
,slist_impl_.last().operator->());
|
||||
slist_impl_.clear();
|
||||
return ret;
|
||||
if(BOOST_LIKELY(!slist_impl_.empty())){
|
||||
std::pair<void_pointer, void_pointer> ret
|
||||
(slist_impl_.begin().operator->()
|
||||
,slist_impl_.last().operator->());
|
||||
slist_impl_.clear();
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
return std::pair<void_pointer, void_pointer>();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct cast_functor
|
||||
{
|
||||
typedef typename container_detail::add_reference<T>::type result_type;
|
||||
typedef typename dtl::add_reference<T>::type result_type;
|
||||
template<class U>
|
||||
result_type operator()(U &ptr) const
|
||||
{ return *static_cast<T*>(static_cast<void*>(&ptr)); }
|
||||
@@ -211,7 +216,7 @@ class transform_multiallocation_chain
|
||||
public:
|
||||
typedef transform_iterator
|
||||
< typename MultiallocationChain::iterator
|
||||
, container_detail::cast_functor <T> > iterator;
|
||||
, dtl::cast_functor <T> > iterator;
|
||||
typedef typename MultiallocationChain::size_type size_type;
|
||||
|
||||
transform_multiallocation_chain()
|
||||
@@ -231,46 +236,46 @@ class transform_multiallocation_chain
|
||||
return static_cast<MultiallocationChain&>
|
||||
(this->MultiallocationChain::operator=(::boost::move(static_cast<MultiallocationChain&>(other))));
|
||||
}
|
||||
/*
|
||||
|
||||
void push_front(const pointer &mem)
|
||||
{ holder_.push_front(mem); }
|
||||
{ this->MultiallocationChain::push_front(mem); }
|
||||
|
||||
void push_back(const pointer &mem)
|
||||
{ return holder_.push_back(mem); }
|
||||
{ return this->MultiallocationChain::push_back(mem); }
|
||||
|
||||
void swap(transform_multiallocation_chain &other_chain)
|
||||
{ holder_.swap(other_chain.holder_); }
|
||||
{ this->MultiallocationChain::swap(other_chain); }
|
||||
|
||||
void splice_after(iterator after_this, transform_multiallocation_chain &x, iterator before_b, iterator before_e, size_type n)
|
||||
{ holder_.splice_after(after_this.base(), x.holder_, before_b.base(), before_e.base(), n); }
|
||||
{ this->MultiallocationChain::splice_after(after_this.base(), x, before_b.base(), before_e.base(), n); }
|
||||
|
||||
void incorporate_after(iterator after_this, pointer b, pointer before_e, size_type n)
|
||||
{ holder_.incorporate_after(after_this.base(), b, before_e, n); }
|
||||
*/
|
||||
{ this->MultiallocationChain::incorporate_after(after_this.base(), b, before_e, n); }
|
||||
|
||||
pointer pop_front()
|
||||
{ return cast(this->MultiallocationChain::pop_front()); }
|
||||
/*
|
||||
|
||||
bool empty() const
|
||||
{ return holder_.empty(); }
|
||||
{ return this->MultiallocationChain::empty(); }
|
||||
|
||||
iterator before_begin()
|
||||
{ return iterator(holder_.before_begin()); }
|
||||
*/
|
||||
{ return iterator(this->MultiallocationChain::before_begin()); }
|
||||
|
||||
iterator begin()
|
||||
{ return iterator(this->MultiallocationChain::begin()); }
|
||||
/*
|
||||
iterator end()
|
||||
{ return iterator(holder_.end()); }
|
||||
|
||||
iterator last()
|
||||
{ return iterator(holder_.last()); }
|
||||
{ return iterator(this->MultiallocationChain::last()); }
|
||||
|
||||
iterator end()
|
||||
{ return iterator(this->MultiallocationChain::end()); }
|
||||
|
||||
size_type size() const
|
||||
{ return holder_.size(); }
|
||||
{ return this->MultiallocationChain::size(); }
|
||||
|
||||
void clear()
|
||||
{ holder_.clear(); }
|
||||
*/
|
||||
{ this->MultiallocationChain::clear(); }
|
||||
|
||||
iterator insert_after(iterator it, pointer m)
|
||||
{ return iterator(this->MultiallocationChain::insert_after(it.base(), m)); }
|
||||
|
||||
@@ -289,7 +294,7 @@ class transform_multiallocation_chain
|
||||
|
||||
}}}
|
||||
|
||||
// namespace container_detail {
|
||||
// namespace dtl {
|
||||
// namespace container {
|
||||
// namespace boost {
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
#if BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_NONE
|
||||
class null_mutex
|
||||
@@ -268,7 +268,7 @@ class scoped_lock
|
||||
Mutex &m_;
|
||||
};
|
||||
|
||||
} // namespace container_detail
|
||||
} // namespace dtl
|
||||
} // namespace container
|
||||
} // namespace boost
|
||||
|
||||
|
||||
@@ -23,52 +23,54 @@
|
||||
// container/detail
|
||||
#include <boost/container/detail/min_max.hpp>
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
enum NextCapacityOption { NextCapacityDouble, NextCapacity60Percent };
|
||||
|
||||
template<class SizeType, NextCapacityOption Option>
|
||||
struct next_capacity_calculator;
|
||||
|
||||
template<class SizeType>
|
||||
struct next_capacity_calculator<SizeType, NextCapacityDouble>
|
||||
template<unsigned Minimum, unsigned Numerator, unsigned Denominator>
|
||||
struct grow_factor_ratio
|
||||
{
|
||||
static SizeType get(const SizeType max_size
|
||||
,const SizeType capacity
|
||||
,const SizeType n)
|
||||
BOOST_STATIC_ASSERT(Numerator > Denominator);
|
||||
BOOST_STATIC_ASSERT(Numerator < 100);
|
||||
BOOST_STATIC_ASSERT(Denominator < 100);
|
||||
BOOST_STATIC_ASSERT(Denominator == 1 || (0 != Numerator % Denominator));
|
||||
|
||||
template<class SizeType>
|
||||
SizeType operator()(const SizeType cur_cap, const SizeType add_min_cap, const SizeType max_cap) const
|
||||
{
|
||||
const SizeType remaining = max_size - capacity;
|
||||
if ( remaining < n )
|
||||
boost::container::throw_length_error("get_next_capacity, allocator's max_size reached");
|
||||
const SizeType additional = max_value(n, capacity);
|
||||
return ( remaining < additional ) ? max_size : ( capacity + additional );
|
||||
const SizeType overflow_limit = ((SizeType)-1) / Numerator;
|
||||
|
||||
SizeType new_cap = 0;
|
||||
|
||||
if(cur_cap <= overflow_limit){
|
||||
new_cap = cur_cap * Numerator / Denominator;
|
||||
}
|
||||
else if(Denominator == 1 || (SizeType(new_cap = cur_cap) / Denominator) > overflow_limit){
|
||||
new_cap = (SizeType)-1;
|
||||
}
|
||||
else{
|
||||
new_cap *= Numerator;
|
||||
}
|
||||
return max_value(SizeType(Minimum), max_value(cur_cap+add_min_cap, min_value(max_cap, new_cap)));
|
||||
}
|
||||
};
|
||||
|
||||
template<class SizeType>
|
||||
struct next_capacity_calculator<SizeType, NextCapacity60Percent>
|
||||
{
|
||||
static SizeType get(const SizeType max_size
|
||||
,const SizeType capacity
|
||||
,const SizeType n)
|
||||
{
|
||||
const SizeType remaining = max_size - capacity;
|
||||
if ( remaining < n )
|
||||
boost::container::throw_length_error("get_next_capacity, allocator's max_size reached");
|
||||
const SizeType m3 = max_size/3;
|
||||
} //namespace dtl {
|
||||
|
||||
if (capacity < m3)
|
||||
return capacity + max_value(3*(capacity+1)/5, n);
|
||||
struct growth_factor_50
|
||||
: dtl::grow_factor_ratio<0, 3, 2>
|
||||
{};
|
||||
|
||||
if (capacity < m3*2)
|
||||
return capacity + max_value((capacity+1)/2, n);
|
||||
return max_size;
|
||||
}
|
||||
};
|
||||
struct growth_factor_60
|
||||
: dtl::grow_factor_ratio<0, 8, 5>
|
||||
{};
|
||||
|
||||
struct growth_factor_100
|
||||
: dtl::grow_factor_ratio<0, 2, 1>
|
||||
{};
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@
|
||||
#include <boost/container/detail/allocator_version_traits.hpp>
|
||||
#include <boost/container/detail/construct_in_place.hpp>
|
||||
#include <boost/container/detail/destroyers.hpp>
|
||||
#include <boost/container/detail/iterator_to_raw_pointer.hpp>
|
||||
#include <boost/move/detail/iterator_to_raw_pointer.hpp>
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
#include <boost/container/detail/placement_new.hpp>
|
||||
#include <boost/container/detail/to_raw_pointer.hpp>
|
||||
#include <boost/move/detail/to_raw_pointer.hpp>
|
||||
#include <boost/container/detail/type_traits.hpp>
|
||||
#include <boost/container/detail/version_type.hpp>
|
||||
// intrusive
|
||||
@@ -50,41 +50,64 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(value_compare)
|
||||
BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(key_compare)
|
||||
BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(key_equal)
|
||||
BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(hasher)
|
||||
BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(predicate_type)
|
||||
|
||||
template<class Allocator, class ICont>
|
||||
struct node_alloc_holder
|
||||
: public allocator_traits<Allocator>::template
|
||||
portable_rebind_alloc<typename ICont::value_type>::type //NodeAlloc
|
||||
{
|
||||
//If the intrusive container is an associative container, obtain the predicate, which will
|
||||
//be of type node_compare<>. If not an associative container value_compare will be a "nat" type.
|
||||
//be of type node_compare<>. If not an associative container val_compare will be a "nat" type.
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
|
||||
( boost::container::container_detail::
|
||||
, ICont, value_compare, container_detail::nat) intrusive_value_compare;
|
||||
( boost::container::dtl::
|
||||
, ICont, key_compare, dtl::nat) intrusive_val_compare;
|
||||
//In that case obtain the value predicate from the node predicate via predicate_type
|
||||
//if intrusive_value_compare is node_compare<>, nat otherwise
|
||||
//if intrusive_val_compare is node_compare<>, nat otherwise
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
|
||||
( boost::container::container_detail::
|
||||
, intrusive_value_compare
|
||||
, predicate_type, container_detail::nat) value_compare;
|
||||
( boost::container::dtl::
|
||||
, intrusive_val_compare
|
||||
, predicate_type, dtl::nat) val_compare;
|
||||
|
||||
//If the intrusive container is a hash container, obtain the predicate, which will
|
||||
//be of type node_compare<>. If not an associative container val_equal will be a "nat" type.
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
|
||||
(boost::container::dtl::
|
||||
, ICont, key_equal, dtl::nat2) intrusive_val_equal;
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
|
||||
(boost::container::dtl::
|
||||
, ICont, hasher, dtl::nat3) intrusive_val_hasher;
|
||||
//In that case obtain the value predicate from the node predicate via predicate_type
|
||||
//if intrusive_val_compare is node_compare<>, nat otherwise
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
|
||||
(boost::container::dtl::
|
||||
, intrusive_val_equal
|
||||
, predicate_type, dtl::nat2) val_equal;
|
||||
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
|
||||
(boost::container::dtl::
|
||||
, intrusive_val_hasher
|
||||
, predicate_type, dtl::nat3) val_hasher;
|
||||
|
||||
typedef allocator_traits<Allocator> allocator_traits_type;
|
||||
typedef typename allocator_traits_type::value_type value_type;
|
||||
typedef typename allocator_traits_type::value_type val_type;
|
||||
typedef ICont intrusive_container;
|
||||
typedef typename ICont::value_type Node;
|
||||
typedef typename allocator_traits_type::template
|
||||
portable_rebind_alloc<Node>::type NodeAlloc;
|
||||
typedef allocator_traits<NodeAlloc> node_allocator_traits_type;
|
||||
typedef container_detail::allocator_version_traits<NodeAlloc> node_allocator_version_traits_type;
|
||||
typedef dtl::allocator_version_traits<NodeAlloc> node_allocator_version_traits_type;
|
||||
typedef Allocator ValAlloc;
|
||||
typedef typename node_allocator_traits_type::pointer NodePtr;
|
||||
typedef container_detail::scoped_deallocator<NodeAlloc> Deallocator;
|
||||
typedef dtl::scoped_deallocator<NodeAlloc> Deallocator;
|
||||
typedef typename node_allocator_traits_type::size_type size_type;
|
||||
typedef typename node_allocator_traits_type::difference_type difference_type;
|
||||
typedef container_detail::integral_constant<unsigned,
|
||||
boost::container::container_detail::
|
||||
typedef dtl::integral_constant<unsigned,
|
||||
boost::container::dtl::
|
||||
version<NodeAlloc>::value> alloc_version;
|
||||
typedef typename ICont::iterator icont_iterator;
|
||||
typedef typename ICont::const_iterator icont_citerator;
|
||||
@@ -99,51 +122,91 @@ struct node_alloc_holder
|
||||
|
||||
//Constructors for sequence containers
|
||||
node_alloc_holder()
|
||||
: members_()
|
||||
{}
|
||||
|
||||
explicit node_alloc_holder(const ValAlloc &a)
|
||||
: members_(a)
|
||||
: NodeAlloc(a)
|
||||
{}
|
||||
|
||||
//Constructors for associative containers
|
||||
node_alloc_holder(const val_compare &c, const ValAlloc &a)
|
||||
: NodeAlloc(a), m_icont(typename ICont::key_compare(c))
|
||||
{}
|
||||
|
||||
node_alloc_holder(const val_hasher &hf, const val_equal &eql, const ValAlloc &a)
|
||||
: NodeAlloc(a)
|
||||
, m_icont(typename ICont::bucket_traits()
|
||||
, typename ICont::hasher(hf)
|
||||
, typename ICont::key_equal(eql))
|
||||
{}
|
||||
|
||||
node_alloc_holder(const val_hasher &hf, const ValAlloc &a)
|
||||
: NodeAlloc(a)
|
||||
, m_icont(typename ICont::bucket_traits()
|
||||
, typename ICont::hasher(hf)
|
||||
, typename ICont::key_equal())
|
||||
{}
|
||||
|
||||
node_alloc_holder(const val_hasher &hf)
|
||||
: m_icont(typename ICont::bucket_traits()
|
||||
, typename ICont::hasher(hf)
|
||||
, typename ICont::key_equal())
|
||||
{}
|
||||
|
||||
explicit node_alloc_holder(const node_alloc_holder &x)
|
||||
: members_(NodeAllocTraits::select_on_container_copy_construction(x.node_alloc()))
|
||||
: NodeAlloc(NodeAllocTraits::select_on_container_copy_construction(x.node_alloc()))
|
||||
{}
|
||||
|
||||
node_alloc_holder(const node_alloc_holder &x, const val_compare &c)
|
||||
: NodeAlloc(NodeAllocTraits::select_on_container_copy_construction(x.node_alloc()))
|
||||
, m_icont(typename ICont::key_compare(c))
|
||||
{}
|
||||
|
||||
node_alloc_holder(const node_alloc_holder &x, const val_hasher &hf, const val_equal &eql)
|
||||
: NodeAlloc(NodeAllocTraits::select_on_container_copy_construction(x.node_alloc()))
|
||||
, m_icont( typename ICont::bucket_traits()
|
||||
, typename ICont::hasher(hf)
|
||||
, typename ICont::key_equal(eql))
|
||||
{}
|
||||
|
||||
node_alloc_holder(const val_hasher &hf, const val_equal &eql)
|
||||
: m_icont(typename ICont::bucket_traits()
|
||||
, typename ICont::hasher(hf)
|
||||
, typename ICont::key_equal(eql))
|
||||
{}
|
||||
|
||||
explicit node_alloc_holder(BOOST_RV_REF(node_alloc_holder) x)
|
||||
: members_(boost::move(x.node_alloc()))
|
||||
: NodeAlloc(boost::move(x.node_alloc()))
|
||||
{ this->icont().swap(x.icont()); }
|
||||
|
||||
//Constructors for associative containers
|
||||
explicit node_alloc_holder(const value_compare &c, const ValAlloc &a)
|
||||
: members_(a, c)
|
||||
{}
|
||||
|
||||
explicit node_alloc_holder(const value_compare &c, const node_alloc_holder &x)
|
||||
: members_(NodeAllocTraits::select_on_container_copy_construction(x.node_alloc()), c)
|
||||
{}
|
||||
|
||||
explicit node_alloc_holder(const value_compare &c)
|
||||
: members_(c)
|
||||
explicit node_alloc_holder(const val_compare &c)
|
||||
: m_icont(typename ICont::key_compare(c))
|
||||
{}
|
||||
|
||||
//helpers for move assignments
|
||||
explicit node_alloc_holder(BOOST_RV_REF(node_alloc_holder) x, const value_compare &c)
|
||||
: members_(boost::move(x.node_alloc()), c)
|
||||
explicit node_alloc_holder(BOOST_RV_REF(node_alloc_holder) x, const val_compare &c)
|
||||
: NodeAlloc(boost::move(x.node_alloc())), m_icont(typename ICont::key_compare(c))
|
||||
{ this->icont().swap(x.icont()); }
|
||||
|
||||
explicit node_alloc_holder(BOOST_RV_REF(node_alloc_holder) x, const val_hasher &hf, const val_equal &eql)
|
||||
: NodeAlloc(boost::move(x.node_alloc()))
|
||||
, m_icont( typename ICont::bucket_traits()
|
||||
, typename ICont::hasher(hf)
|
||||
, typename ICont::key_equal(eql))
|
||||
{ this->icont().swap(x.icont()); }
|
||||
|
||||
void copy_assign_alloc(const node_alloc_holder &x)
|
||||
{
|
||||
container_detail::bool_<allocator_traits_type::propagate_on_container_copy_assignment::value> flag;
|
||||
container_detail::assign_alloc( static_cast<NodeAlloc &>(this->members_)
|
||||
, static_cast<const NodeAlloc &>(x.members_), flag);
|
||||
dtl::bool_<allocator_traits_type::propagate_on_container_copy_assignment::value> flag;
|
||||
dtl::assign_alloc( static_cast<NodeAlloc &>(*this)
|
||||
, static_cast<const NodeAlloc &>(x), flag);
|
||||
}
|
||||
|
||||
void move_assign_alloc( node_alloc_holder &x)
|
||||
{
|
||||
container_detail::bool_<allocator_traits_type::propagate_on_container_move_assignment::value> flag;
|
||||
container_detail::move_alloc( static_cast<NodeAlloc &>(this->members_)
|
||||
, static_cast<NodeAlloc &>(x.members_), flag);
|
||||
dtl::bool_<allocator_traits_type::propagate_on_container_move_assignment::value> flag;
|
||||
dtl::move_alloc( static_cast<NodeAlloc &>(*this)
|
||||
, static_cast<NodeAlloc &>(x), flag);
|
||||
}
|
||||
|
||||
~node_alloc_holder()
|
||||
@@ -164,14 +227,18 @@ struct node_alloc_holder
|
||||
NodePtr create_node(Args &&...args)
|
||||
{
|
||||
NodePtr p = this->allocate_one();
|
||||
Deallocator node_deallocator(p, this->node_alloc());
|
||||
allocator_traits<NodeAlloc>::construct
|
||||
( this->node_alloc()
|
||||
, container_detail::addressof(p->m_data), boost::forward<Args>(args)...);
|
||||
node_deallocator.release();
|
||||
//This does not throw
|
||||
typedef typename Node::hook_type hook_type;
|
||||
::new(static_cast<hook_type*>(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type;
|
||||
BOOST_TRY{
|
||||
::new(boost::movelib::iterator_to_raw_pointer(p), boost_container_new_t()) Node;
|
||||
allocator_traits<NodeAlloc>::construct
|
||||
(this->node_alloc()
|
||||
, p->get_real_data_ptr(), boost::forward<Args>(args)...);
|
||||
}
|
||||
BOOST_CATCH(...) {
|
||||
p->destroy_header();
|
||||
this->node_alloc().deallocate(p, 1);
|
||||
BOOST_RETHROW
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
return (p);
|
||||
}
|
||||
|
||||
@@ -182,14 +249,19 @@ struct node_alloc_holder
|
||||
NodePtr create_node(BOOST_MOVE_UREF##N)\
|
||||
{\
|
||||
NodePtr p = this->allocate_one();\
|
||||
Deallocator node_deallocator(p, this->node_alloc());\
|
||||
allocator_traits<NodeAlloc>::construct\
|
||||
( this->node_alloc()\
|
||||
, container_detail::addressof(p->m_data)\
|
||||
BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
|
||||
node_deallocator.release();\
|
||||
typedef typename Node::hook_type hook_type;\
|
||||
::new(static_cast<hook_type*>(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type;\
|
||||
BOOST_TRY{\
|
||||
::new(boost::movelib::iterator_to_raw_pointer(p), boost_container_new_t()) Node;\
|
||||
allocator_traits<NodeAlloc>::construct\
|
||||
( this->node_alloc()\
|
||||
, p->get_real_data_ptr()\
|
||||
BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
|
||||
}\
|
||||
BOOST_CATCH(...) {\
|
||||
p->destroy_header();\
|
||||
this->node_alloc().deallocate(p, 1);\
|
||||
BOOST_RETHROW\
|
||||
}\
|
||||
BOOST_CATCH_END\
|
||||
return (p);\
|
||||
}\
|
||||
//
|
||||
@@ -202,12 +274,16 @@ struct node_alloc_holder
|
||||
NodePtr create_node_from_it(const It &it)
|
||||
{
|
||||
NodePtr p = this->allocate_one();
|
||||
Deallocator node_deallocator(p, this->node_alloc());
|
||||
::boost::container::construct_in_place(this->node_alloc(), container_detail::addressof(p->m_data), it);
|
||||
node_deallocator.release();
|
||||
//This does not throw
|
||||
typedef typename Node::hook_type hook_type;
|
||||
::new(static_cast<hook_type*>(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type;
|
||||
BOOST_TRY{
|
||||
::new(boost::movelib::iterator_to_raw_pointer(p), boost_container_new_t()) Node;
|
||||
::boost::container::construct_in_place(this->node_alloc(), p->get_real_data_ptr(), it);
|
||||
}
|
||||
BOOST_CATCH(...) {
|
||||
p->destroy_header();
|
||||
this->node_alloc().deallocate(p, 1);
|
||||
BOOST_RETHROW
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
return (p);
|
||||
}
|
||||
|
||||
@@ -215,36 +291,40 @@ struct node_alloc_holder
|
||||
NodePtr create_node_from_key(BOOST_FWD_REF(KeyConvertible) key)
|
||||
{
|
||||
NodePtr p = this->allocate_one();
|
||||
NodeAlloc &na = this->node_alloc();
|
||||
Deallocator node_deallocator(p, this->node_alloc());
|
||||
node_allocator_traits_type::construct
|
||||
(na, container_detail::addressof(p->m_data.first), boost::forward<KeyConvertible>(key));
|
||||
BOOST_TRY{
|
||||
node_allocator_traits_type::construct(na, container_detail::addressof(p->m_data.second));
|
||||
::new(boost::movelib::iterator_to_raw_pointer(p), boost_container_new_t()) Node;
|
||||
NodeAlloc &na = this->node_alloc();
|
||||
node_allocator_traits_type::construct
|
||||
(na, dtl::addressof(p->get_real_data().first), boost::forward<KeyConvertible>(key));
|
||||
BOOST_TRY{
|
||||
node_allocator_traits_type::construct(na, dtl::addressof(p->get_real_data().second));
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
node_allocator_traits_type::destroy(na, dtl::addressof(p->get_real_data().first));
|
||||
BOOST_RETHROW;
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
node_allocator_traits_type::destroy(na, container_detail::addressof(p->m_data.first));
|
||||
BOOST_RETHROW;
|
||||
BOOST_CATCH(...) {
|
||||
p->destroy_header();
|
||||
this->node_alloc().deallocate(p, 1);
|
||||
BOOST_RETHROW
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
node_deallocator.release();
|
||||
//This does not throw
|
||||
typedef typename Node::hook_type hook_type;
|
||||
::new(static_cast<hook_type*>(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type;
|
||||
return (p);
|
||||
}
|
||||
|
||||
void destroy_node(const NodePtr &nodep)
|
||||
{
|
||||
allocator_traits<NodeAlloc>::destroy(this->node_alloc(), container_detail::to_raw_pointer(nodep));
|
||||
allocator_traits<NodeAlloc>::destroy(this->node_alloc(), boost::movelib::to_raw_pointer(nodep));
|
||||
this->deallocate_one(nodep);
|
||||
}
|
||||
|
||||
void swap(node_alloc_holder &x)
|
||||
{
|
||||
this->icont().swap(x.icont());
|
||||
container_detail::bool_<allocator_traits_type::propagate_on_container_swap::value> flag;
|
||||
container_detail::swap_alloc(this->node_alloc(), x.node_alloc(), flag);
|
||||
dtl::bool_<allocator_traits_type::propagate_on_container_swap::value> flag;
|
||||
dtl::swap_alloc(this->node_alloc(), x.node_alloc(), flag);
|
||||
}
|
||||
|
||||
template<class FwdIterator, class Inserter>
|
||||
@@ -252,30 +332,32 @@ struct node_alloc_holder
|
||||
(FwdIterator beg, difference_type n, Inserter inserter)
|
||||
{
|
||||
if(n){
|
||||
typedef typename node_allocator_version_traits_type::multiallocation_chain multiallocation_chain;
|
||||
typedef typename node_allocator_version_traits_type::multiallocation_chain multiallocation_chain_t;
|
||||
|
||||
//Try to allocate memory in a single block
|
||||
typedef typename multiallocation_chain::iterator multialloc_iterator;
|
||||
multiallocation_chain mem;
|
||||
typedef typename multiallocation_chain_t::iterator multialloc_iterator_t;
|
||||
multiallocation_chain_t chain;
|
||||
NodeAlloc &nalloc = this->node_alloc();
|
||||
node_allocator_version_traits_type::allocate_individual(nalloc, n, mem);
|
||||
multialloc_iterator itbeg(mem.begin()), itlast(mem.last());
|
||||
mem.clear();
|
||||
node_allocator_version_traits_type::allocate_individual(nalloc, n, chain);
|
||||
multialloc_iterator_t itbeg = chain.begin();
|
||||
multialloc_iterator_t itlast = chain.last();
|
||||
chain.clear();
|
||||
|
||||
Node *p = 0;
|
||||
BOOST_TRY{
|
||||
BOOST_TRY{
|
||||
Deallocator node_deallocator(NodePtr(), nalloc);
|
||||
container_detail::scoped_destructor<NodeAlloc> sdestructor(nalloc, 0);
|
||||
while(n--){
|
||||
p = container_detail::iterator_to_raw_pointer(itbeg);
|
||||
dtl::scoped_destructor<NodeAlloc> sdestructor(nalloc, 0);
|
||||
while(n){
|
||||
--n;
|
||||
p = boost::movelib::iterator_to_raw_pointer(itbeg);
|
||||
++itbeg; //Increment iterator before overwriting pointed memory
|
||||
//This does not throw
|
||||
p = ::new(p, boost_container_new_t()) Node;
|
||||
node_deallocator.set(p);
|
||||
++itbeg;
|
||||
//This can throw
|
||||
boost::container::construct_in_place(nalloc, container_detail::addressof(p->m_data), beg);
|
||||
boost::container::construct_in_place(nalloc, p->get_real_data_ptr(), beg);
|
||||
sdestructor.set(p);
|
||||
++beg;
|
||||
//This does not throw
|
||||
typedef typename Node::hook_type hook_type;
|
||||
::new(static_cast<hook_type*>(p), boost_container_new_t()) hook_type;
|
||||
//This can throw in some containers (predicate might throw).
|
||||
//(sdestructor will destruct the node and node_deallocator will deallocate it in case of exception)
|
||||
inserter(*p);
|
||||
@@ -285,8 +367,9 @@ struct node_alloc_holder
|
||||
node_deallocator.release();
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
mem.incorporate_after(mem.last(), &*itbeg, &*itlast, n);
|
||||
node_allocator_version_traits_type::deallocate_individual(this->node_alloc(), mem);
|
||||
p->destroy_header();
|
||||
chain.incorporate_after(chain.last(), &*itbeg, &*itlast, n);
|
||||
node_allocator_version_traits_type::deallocate_individual(this->node_alloc(), chain);
|
||||
BOOST_RETHROW
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
@@ -339,7 +422,7 @@ struct node_alloc_holder
|
||||
{}
|
||||
|
||||
NodePtr operator()(const Node &other) const
|
||||
{ return m_holder.create_node(other.m_data); }
|
||||
{ return m_holder.create_node(other.get_real_data()); }
|
||||
|
||||
node_alloc_holder &m_holder;
|
||||
};
|
||||
@@ -351,66 +434,35 @@ struct node_alloc_holder
|
||||
{}
|
||||
|
||||
NodePtr operator()(Node &other)
|
||||
{ //Use m_data instead of get_data to allow moving const key in [multi]map
|
||||
return m_holder.create_node(::boost::move(other.m_data));
|
||||
{ //Use get_real_data() instead of get_real_data to allow moving const key in [multi]map
|
||||
return m_holder.create_node(::boost::move(other.get_real_data()));
|
||||
}
|
||||
|
||||
node_alloc_holder &m_holder;
|
||||
};
|
||||
|
||||
struct members_holder
|
||||
: public NodeAlloc
|
||||
{
|
||||
private:
|
||||
members_holder(const members_holder&);
|
||||
members_holder & operator=(const members_holder&);
|
||||
|
||||
public:
|
||||
members_holder()
|
||||
: NodeAlloc(), m_icont()
|
||||
{}
|
||||
|
||||
template<class ConvertibleToAlloc>
|
||||
explicit members_holder(BOOST_FWD_REF(ConvertibleToAlloc) c2alloc)
|
||||
: NodeAlloc(boost::forward<ConvertibleToAlloc>(c2alloc))
|
||||
, m_icont()
|
||||
{}
|
||||
|
||||
template<class ConvertibleToAlloc>
|
||||
members_holder(BOOST_FWD_REF(ConvertibleToAlloc) c2alloc, const value_compare &c)
|
||||
: NodeAlloc(boost::forward<ConvertibleToAlloc>(c2alloc))
|
||||
, m_icont(typename ICont::key_compare(c))
|
||||
{}
|
||||
|
||||
explicit members_holder(const value_compare &c)
|
||||
: NodeAlloc()
|
||||
, m_icont(typename ICont::key_compare(c))
|
||||
{}
|
||||
|
||||
//The intrusive container
|
||||
ICont m_icont;
|
||||
};
|
||||
|
||||
ICont &non_const_icont() const
|
||||
{ return const_cast<ICont&>(this->members_.m_icont); }
|
||||
{ return const_cast<ICont&>(this->m_icont); }
|
||||
|
||||
NodeAlloc &node_alloc()
|
||||
{ return static_cast<NodeAlloc &>(this->members_); }
|
||||
{ return static_cast<NodeAlloc &>(*this); }
|
||||
|
||||
const NodeAlloc &node_alloc() const
|
||||
{ return static_cast<const NodeAlloc &>(this->members_); }
|
||||
|
||||
members_holder members_;
|
||||
{ return static_cast<const NodeAlloc &>(*this); }
|
||||
|
||||
public:
|
||||
ICont &icont()
|
||||
{ return this->members_.m_icont; }
|
||||
{ return this->m_icont; }
|
||||
|
||||
const ICont &icont() const
|
||||
{ return this->members_.m_icont; }
|
||||
{ return this->m_icont; }
|
||||
|
||||
private:
|
||||
//The intrusive container
|
||||
ICont m_icont;
|
||||
};
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
//!Pooled memory allocator using single segregated storage. Includes
|
||||
//!a reference count but the class does not delete itself, this is
|
||||
@@ -41,10 +41,10 @@ namespace container_detail {
|
||||
template< std::size_t NodeSize, std::size_t NodesPerBlock >
|
||||
class private_node_pool
|
||||
//Inherit from the implementation to avoid template bloat
|
||||
: public boost::container::container_detail::
|
||||
: public boost::container::dtl::
|
||||
private_node_pool_impl<fake_segment_manager>
|
||||
{
|
||||
typedef boost::container::container_detail::
|
||||
typedef boost::container::dtl::
|
||||
private_node_pool_impl<fake_segment_manager> base_t;
|
||||
//Non-copyable
|
||||
private_node_pool(const private_node_pool &);
|
||||
@@ -148,7 +148,7 @@ class shared_node_pool
|
||||
default_mutex mutex_;
|
||||
};
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <boost/container/detail/math_functions.hpp>
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
#include <boost/container/detail/pool_common.hpp>
|
||||
#include <boost/container/detail/to_raw_pointer.hpp>
|
||||
#include <boost/move/detail/to_raw_pointer.hpp>
|
||||
#include <boost/container/detail/type_traits.hpp>
|
||||
|
||||
#include <boost/intrusive/pointer_traits.hpp>
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
template<class SegmentManagerBase>
|
||||
class private_node_pool_impl
|
||||
@@ -92,7 +92,7 @@ class private_node_pool_impl
|
||||
|
||||
//!Returns the segment manager. Never throws
|
||||
segment_manager_base_type* get_segment_manager_base()const
|
||||
{ return container_detail::to_raw_pointer(mp_segment_mngr_base); }
|
||||
{ return boost::movelib::to_raw_pointer(mp_segment_mngr_base); }
|
||||
|
||||
void *allocate_node()
|
||||
{ return this->priv_alloc_node(); }
|
||||
@@ -366,7 +366,7 @@ class private_node_pool_impl
|
||||
};
|
||||
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <boost/container/detail/config_begin.hpp>
|
||||
#include <boost/container/detail/workaround.hpp>
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
#include <boost/container/detail/type_traits.hpp>
|
||||
#include <boost/container/detail/mpl.hpp>
|
||||
@@ -35,16 +36,62 @@
|
||||
|
||||
#include <boost/intrusive/detail/minimal_pair_header.hpp> //pair
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include<boost/move/detail/fwd_macros.hpp>
|
||||
#include <boost/move/detail/fwd_macros.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace tuples {
|
||||
|
||||
struct null_type;
|
||||
|
||||
template <
|
||||
class T0, class T1, class T2,
|
||||
class T3, class T4, class T5,
|
||||
class T6, class T7, class T8,
|
||||
class T9>
|
||||
class tuple;
|
||||
|
||||
} //namespace tuples {
|
||||
} //namespace boost {
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace pair_impl {
|
||||
|
||||
template <class TupleClass>
|
||||
struct is_boost_tuple
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template <
|
||||
class T0, class T1, class T2,
|
||||
class T3, class T4, class T5,
|
||||
class T6, class T7, class T8,
|
||||
class T9>
|
||||
struct is_boost_tuple< boost::tuples::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template<class Tuple>
|
||||
struct disable_if_boost_tuple
|
||||
: boost::container::dtl::disable_if< is_boost_tuple<Tuple> >
|
||||
{};
|
||||
|
||||
template<class T>
|
||||
struct is_tuple_null
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct is_tuple_null<boost::tuples::null_type>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#if defined(BOOST_MSVC) && (_CPPLIB_VER == 520)
|
||||
//MSVC 2010 tuple marker
|
||||
namespace std { namespace tr1 { struct _Nil; }}
|
||||
@@ -87,7 +134,7 @@ static piecewise_construct_t piecewise_construct = BOOST_CONTAINER_DOC1ST(unspec
|
||||
|
||||
///@cond
|
||||
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
struct piecewise_construct_use
|
||||
{
|
||||
@@ -142,8 +189,36 @@ void get(T); //to enable ADL
|
||||
|
||||
///@endcond
|
||||
|
||||
#ifdef _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
|
||||
//Libc++, in some versions, has an ABI breakage that needs some
|
||||
//padding in dtl::pair, as "std::pair::first" is not at offset zero.
|
||||
//See: https://reviews.llvm.org/D56357 for more information.
|
||||
//
|
||||
template <class T1, class T2, std::size_t N>
|
||||
struct pair_padding
|
||||
{
|
||||
char padding[N];
|
||||
};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct pair_padding<T1, T2, 0>
|
||||
{
|
||||
};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct simple_pair
|
||||
{
|
||||
T1 first;
|
||||
T2 second;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
template <class T1, class T2>
|
||||
struct pair
|
||||
#ifdef _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
|
||||
: pair_padding<T1, T2, sizeof(std::pair<T1, T2>) - sizeof(simple_pair<T1, T2>)>
|
||||
#endif
|
||||
{
|
||||
private:
|
||||
BOOST_COPYABLE_AND_MOVABLE(pair)
|
||||
@@ -158,64 +233,88 @@ struct pair
|
||||
//Default constructor
|
||||
pair()
|
||||
: first(), second()
|
||||
{}
|
||||
{
|
||||
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
|
||||
}
|
||||
|
||||
//pair copy assignment
|
||||
pair(const pair& x)
|
||||
: first(x.first), second(x.second)
|
||||
{}
|
||||
{
|
||||
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
|
||||
}
|
||||
|
||||
//pair move constructor
|
||||
pair(BOOST_RV_REF(pair) p)
|
||||
: first(::boost::move(p.first)), second(::boost::move(p.second))
|
||||
{}
|
||||
{
|
||||
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
|
||||
}
|
||||
|
||||
template <class D, class S>
|
||||
pair(const pair<D, S> &p)
|
||||
: first(p.first), second(p.second)
|
||||
{}
|
||||
{
|
||||
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
|
||||
}
|
||||
|
||||
template <class D, class S>
|
||||
pair(BOOST_RV_REF_BEG pair<D, S> BOOST_RV_REF_END p)
|
||||
: first(::boost::move(p.first)), second(::boost::move(p.second))
|
||||
{}
|
||||
{
|
||||
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
|
||||
}
|
||||
|
||||
//pair from two values
|
||||
pair(const T1 &t1, const T2 &t2)
|
||||
: first(t1)
|
||||
, second(t2)
|
||||
{}
|
||||
{
|
||||
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
|
||||
}
|
||||
|
||||
template<class U, class V>
|
||||
pair(BOOST_FWD_REF(U) u, BOOST_FWD_REF(V) v)
|
||||
: first(::boost::forward<U>(u))
|
||||
, second(::boost::forward<V>(v))
|
||||
{}
|
||||
{
|
||||
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
|
||||
}
|
||||
|
||||
//And now compatibility with std::pair
|
||||
pair(const std::pair<T1, T2>& x)
|
||||
: first(x.first), second(x.second)
|
||||
{}
|
||||
{
|
||||
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
|
||||
}
|
||||
|
||||
template <class D, class S>
|
||||
pair(const std::pair<D, S>& p)
|
||||
: first(p.first), second(p.second)
|
||||
{}
|
||||
{
|
||||
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
|
||||
}
|
||||
|
||||
pair(BOOST_RV_REF_BEG std::pair<T1, T2> BOOST_RV_REF_END p)
|
||||
: first(::boost::move(p.first)), second(::boost::move(p.second))
|
||||
{}
|
||||
{
|
||||
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
|
||||
}
|
||||
|
||||
template <class D, class S>
|
||||
pair(BOOST_RV_REF_BEG std::pair<D, S> BOOST_RV_REF_END p)
|
||||
: first(::boost::move(p.first)), second(::boost::move(p.second))
|
||||
{}
|
||||
{
|
||||
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template< class KeyType, class ...Args>
|
||||
pair(try_emplace_t, BOOST_FWD_REF(KeyType) k, Args && ...args)
|
||||
: first(boost::forward<KeyType>(k)), second(::boost::forward<Args>(args)...)\
|
||||
{}
|
||||
{
|
||||
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
|
||||
}
|
||||
#else
|
||||
|
||||
//piecewise construction from boost::tuple
|
||||
@@ -223,7 +322,9 @@ struct pair
|
||||
template< class KeyType BOOST_MOVE_I##N BOOST_MOVE_CLASS##N > \
|
||||
pair( try_emplace_t, BOOST_FWD_REF(KeyType) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N )\
|
||||
: first(boost::forward<KeyType>(k)), second(BOOST_MOVE_FWD##N)\
|
||||
{}\
|
||||
{\
|
||||
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));\
|
||||
}\
|
||||
//
|
||||
BOOST_MOVE_ITERATE_0TO9(BOOST_PAIR_TRY_EMPLACE_CONSTRUCT_CODE)
|
||||
#undef BOOST_PAIR_TRY_EMPLACE_CONSTRUCT_CODE
|
||||
@@ -236,9 +337,16 @@ struct pair
|
||||
BOOST_MOVE_I_IF(BOOST_MOVE_OR(N,M)) BOOST_MOVE_CLASS##N BOOST_MOVE_I_IF(BOOST_MOVE_AND(N,M)) BOOST_MOVE_CLASSQ##M > \
|
||||
pair( piecewise_construct_t\
|
||||
, BoostTuple<BOOST_MOVE_TARG##N BOOST_MOVE_I##N BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(10,N),::boost::tuples::null_type)> p\
|
||||
, BoostTuple<BOOST_MOVE_TARGQ##M BOOST_MOVE_I##M BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(10,M),::boost::tuples::null_type)> q)\
|
||||
, BoostTuple<BOOST_MOVE_TARGQ##M BOOST_MOVE_I##M BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(10,M),::boost::tuples::null_type)> q\
|
||||
, typename dtl::enable_if_c\
|
||||
< pair_impl::is_boost_tuple< BoostTuple<BOOST_MOVE_TARG##N BOOST_MOVE_I##N BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(10,N),::boost::tuples::null_type)> >::value &&\
|
||||
!(pair_impl::is_tuple_null<BOOST_MOVE_LAST_TARG##N>::value || pair_impl::is_tuple_null<BOOST_MOVE_LAST_TARGQ##M>::value) \
|
||||
>::type* = 0\
|
||||
)\
|
||||
: first(BOOST_MOVE_TMPL_GET##N), second(BOOST_MOVE_TMPL_GETQ##M)\
|
||||
{ (void)p; (void)q; }\
|
||||
{ (void)p; (void)q;\
|
||||
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));\
|
||||
}\
|
||||
//
|
||||
BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_PAIR_PIECEWISE_CONSTRUCT_BOOST_TUPLE_CODE)
|
||||
#undef BOOST_PAIR_PIECEWISE_CONSTRUCT_BOOST_TUPLE_CODE
|
||||
@@ -254,10 +362,13 @@ struct pair
|
||||
{ (void) t1; (void)t2; }
|
||||
|
||||
public:
|
||||
template<template<class ...> class Tuple, class... Args1, class... Args2>
|
||||
template< template<class ...> class Tuple, class... Args1, class... Args2
|
||||
, class = typename pair_impl::disable_if_boost_tuple< Tuple<Args1...> >::type>
|
||||
pair(piecewise_construct_t, Tuple<Args1...> t1, Tuple<Args2...> t2)
|
||||
: pair(t1, t2, typename build_number_seq<sizeof...(Args1)>::type(), typename build_number_seq<sizeof...(Args2)>::type())
|
||||
{}
|
||||
{
|
||||
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
|
||||
}
|
||||
# else
|
||||
//piecewise construction from variadic tuple (suboptimal, without delegating constructors)
|
||||
private:
|
||||
@@ -270,11 +381,14 @@ struct pair
|
||||
{ (void)t; return T(::boost::forward<Args>(get<Indexes>(t))...); }
|
||||
|
||||
public:
|
||||
template<template<class ...> class Tuple, class... Args1, class... Args2>
|
||||
template< template<class ...> class Tuple, class... Args1, class... Args2
|
||||
, class = typename pair_impl::disable_if_boost_tuple< Tuple<Args1...> >::type>
|
||||
pair(piecewise_construct_t, Tuple<Args1...> t1, Tuple<Args2...> t2)
|
||||
: first (build_from_args<first_type> (::boost::move(t1)))
|
||||
, second (build_from_args<second_type>(::boost::move(t2)))
|
||||
{}
|
||||
{
|
||||
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));
|
||||
}
|
||||
# endif //BOOST_NO_CXX11_VARIADIC_TEMPLATES
|
||||
#elif defined(BOOST_MSVC) && (_CPPLIB_VER == 520)
|
||||
//MSVC 2010 tuple implementation
|
||||
@@ -285,7 +399,9 @@ struct pair
|
||||
, StdTuple<BOOST_MOVE_TARG##N BOOST_MOVE_I##N BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(10,N),::std::tr1::_Nil)> p\
|
||||
, StdTuple<BOOST_MOVE_TARGQ##M BOOST_MOVE_I##M BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(10,M),::std::tr1::_Nil)> q)\
|
||||
: first(BOOST_MOVE_GET_IDX##N), second(BOOST_MOVE_GET_IDXQ##M)\
|
||||
{ (void)p; (void)q; }\
|
||||
{ (void)p; (void)q;\
|
||||
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));\
|
||||
}\
|
||||
//
|
||||
BOOST_MOVE_ITER2D_0TOMAX(9, BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2010_TUPLE_CODE)
|
||||
#undef BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2010_TUPLE_CODE
|
||||
@@ -304,7 +420,9 @@ struct pair
|
||||
, StdTuple<BOOST_MOVE_TARG##N BOOST_MOVE_I##N BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(BOOST_MOVE_ADD(_VARIADIC_MAX, 3),N),::std::_Nil) > p\
|
||||
, StdTuple<BOOST_MOVE_TARGQ##M BOOST_MOVE_I##M BOOST_MOVE_REPEAT(BOOST_MOVE_SUB(BOOST_MOVE_ADD(_VARIADIC_MAX, 3),M),::std::_Nil) > q)\
|
||||
: first(BOOST_MOVE_GET_IDX##N), second(BOOST_MOVE_GET_IDXQ##M)\
|
||||
{ (void)p; (void)q; }\
|
||||
{ (void)p; (void)q;\
|
||||
BOOST_STATIC_ASSERT((sizeof(std::pair<T1, T2>) == sizeof(pair<T1, T2>)));\
|
||||
}\
|
||||
//
|
||||
BOOST_MOVE_ITER2D_0TOMAX(BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_MAX_IT, BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2012_TUPLE_CODE)
|
||||
#undef BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2010_TUPLE_CODE
|
||||
@@ -328,10 +446,10 @@ struct pair
|
||||
}
|
||||
|
||||
template <class D, class S>
|
||||
typename ::boost::container::container_detail::disable_if_or
|
||||
typename ::boost::container::dtl::disable_if_or
|
||||
< pair &
|
||||
, ::boost::container::container_detail::is_same<T1, D>
|
||||
, ::boost::container::container_detail::is_same<T2, S>
|
||||
, ::boost::container::dtl::is_same<T1, D>
|
||||
, ::boost::container::dtl::is_same<T2, S>
|
||||
>::type
|
||||
operator=(const pair<D, S>&p)
|
||||
{
|
||||
@@ -341,10 +459,10 @@ struct pair
|
||||
}
|
||||
|
||||
template <class D, class S>
|
||||
typename ::boost::container::container_detail::disable_if_or
|
||||
typename ::boost::container::dtl::disable_if_or
|
||||
< pair &
|
||||
, ::boost::container::container_detail::is_same<T1, D>
|
||||
, ::boost::container::container_detail::is_same<T2, S>
|
||||
, ::boost::container::dtl::is_same<T1, D>
|
||||
, ::boost::container::dtl::is_same<T2, S>
|
||||
>::type
|
||||
operator=(BOOST_RV_REF_BEG pair<D, S> BOOST_RV_REF_END p)
|
||||
{
|
||||
@@ -425,13 +543,13 @@ template <class T1, class T2>
|
||||
inline void swap(pair<T1, T2>& x, pair<T1, T2>& y)
|
||||
{ x.swap(y); }
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
|
||||
#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
template<class T1, class T2>
|
||||
struct has_move_emulation_enabled< ::boost::container::container_detail::pair<T1, T2> >
|
||||
struct has_move_emulation_enabled< ::boost::container::dtl::pair<T1, T2> >
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
@@ -444,7 +562,7 @@ template<class T>
|
||||
struct is_class_or_union;
|
||||
|
||||
template <class T1, class T2>
|
||||
struct is_class_or_union< ::boost::container::container_detail::pair<T1, T2> >
|
||||
struct is_class_or_union< ::boost::container::dtl::pair<T1, T2> >
|
||||
//This specialization is needed to avoid instantiation of pair in
|
||||
//is_class, and allow recursive maps.
|
||||
{
|
||||
@@ -463,7 +581,7 @@ template<class T>
|
||||
struct is_union;
|
||||
|
||||
template <class T1, class T2>
|
||||
struct is_union< ::boost::container::container_detail::pair<T1, T2> >
|
||||
struct is_union< ::boost::container::dtl::pair<T1, T2> >
|
||||
//This specialization is needed to avoid instantiation of pair in
|
||||
//is_class, and allow recursive maps.
|
||||
{
|
||||
@@ -482,7 +600,7 @@ template<class T>
|
||||
struct is_class;
|
||||
|
||||
template <class T1, class T2>
|
||||
struct is_class< ::boost::container::container_detail::pair<T1, T2> >
|
||||
struct is_class< ::boost::container::dtl::pair<T1, T2> >
|
||||
//This specialization is needed to avoid instantiation of pair in
|
||||
//is_class, and allow recursive maps.
|
||||
{
|
||||
@@ -497,6 +615,61 @@ struct is_class< std::pair<T1, T2> >
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
|
||||
//Triviality of pair
|
||||
template<class T>
|
||||
struct is_trivially_copy_constructible;
|
||||
|
||||
template<class A, class B>
|
||||
struct is_trivially_copy_assignable
|
||||
<boost::container::dtl::pair<A,B> >
|
||||
{
|
||||
static const bool value = boost::move_detail::is_trivially_copy_assignable<A>::value &&
|
||||
boost::move_detail::is_trivially_copy_assignable<B>::value ;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct is_trivially_move_constructible;
|
||||
|
||||
template<class A, class B>
|
||||
struct is_trivially_move_assignable
|
||||
<boost::container::dtl::pair<A,B> >
|
||||
{
|
||||
static const bool value = boost::move_detail::is_trivially_move_assignable<A>::value &&
|
||||
boost::move_detail::is_trivially_move_assignable<B>::value ;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct is_trivially_copy_assignable;
|
||||
|
||||
template<class A, class B>
|
||||
struct is_trivially_copy_constructible<boost::container::dtl::pair<A,B> >
|
||||
{
|
||||
static const bool value = boost::move_detail::is_trivially_copy_constructible<A>::value &&
|
||||
boost::move_detail::is_trivially_copy_constructible<B>::value ;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct is_trivially_move_assignable;
|
||||
|
||||
template<class A, class B>
|
||||
struct is_trivially_move_constructible<boost::container::dtl::pair<A,B> >
|
||||
{
|
||||
static const bool value = boost::move_detail::is_trivially_move_constructible<A>::value &&
|
||||
boost::move_detail::is_trivially_move_constructible<B>::value ;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct is_trivially_destructible;
|
||||
|
||||
template<class A, class B>
|
||||
struct is_trivially_destructible<boost::container::dtl::pair<A,B> >
|
||||
{
|
||||
static const bool value = boost::move_detail::is_trivially_destructible<A>::value &&
|
||||
boost::move_detail::is_trivially_destructible<B>::value ;
|
||||
};
|
||||
|
||||
|
||||
} //namespace move_detail{
|
||||
|
||||
} //namespace boost {
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (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_PAIR_KEY_MAPPED_OF_VALUE_HPP
|
||||
#define BOOST_CONTAINER_PAIR_KEY_MAPPED_OF_VALUE_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/container/detail/config_begin.hpp>
|
||||
#include <boost/container/detail/workaround.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
|
||||
template<class Key, class Mapped>
|
||||
struct pair_key_mapped_of_value
|
||||
{
|
||||
typedef Key key_type;
|
||||
typedef Mapped mapped_type;
|
||||
|
||||
template<class Pair>
|
||||
const key_type & key_of_value(const Pair &p) const
|
||||
{ return p.first; }
|
||||
|
||||
template<class Pair>
|
||||
const mapped_type & mapped_of_value(const Pair &p) const
|
||||
{ return p.second; }
|
||||
|
||||
template<class Pair>
|
||||
key_type & key_of_value(Pair &p) const
|
||||
{ return const_cast<key_type&>(p.first); }
|
||||
|
||||
template<class Pair>
|
||||
mapped_type & mapped_of_value(Pair &p) const
|
||||
{ return p.second; }
|
||||
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#include <boost/container/detail/config_end.hpp>
|
||||
|
||||
#endif // BOOST_CONTAINER_PAIR_KEY_MAPPED_OF_VALUE_HPP
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
template<class VoidPointer>
|
||||
struct node_slist
|
||||
@@ -48,7 +48,7 @@ struct is_stateless_segment_manager
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@
|
||||
|
||||
namespace boost{
|
||||
namespace container{
|
||||
namespace container_detail{
|
||||
namespace dtl{
|
||||
|
||||
struct node_slist_helper
|
||||
: public boost::container::container_detail::node_slist<void*>
|
||||
: public boost::container::dtl::node_slist<void*>
|
||||
{};
|
||||
|
||||
struct fake_segment_manager
|
||||
@@ -41,7 +41,7 @@ struct fake_segment_manager
|
||||
typedef void * void_pointer;
|
||||
static const std::size_t PayloadPerAllocation = BOOST_CONTAINER_ALLOCATION_PAYLOAD;
|
||||
|
||||
typedef boost::container::container_detail::
|
||||
typedef boost::container::dtl::
|
||||
basic_multiallocation_chain<void*> multiallocation_chain;
|
||||
static void deallocate(void_pointer p)
|
||||
{ dlmalloc_free(p); }
|
||||
@@ -77,23 +77,23 @@ struct fake_segment_manager
|
||||
|
||||
} //namespace boost{
|
||||
} //namespace container{
|
||||
} //namespace container_detail{
|
||||
} //namespace dtl{
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
template<class T>
|
||||
struct is_stateless_segment_manager;
|
||||
|
||||
template<>
|
||||
struct is_stateless_segment_manager
|
||||
<boost::container::container_detail::fake_segment_manager>
|
||||
<boost::container::dtl::fake_segment_manager>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
// T must be: no-throw default constructible and no-throw destructible
|
||||
template <typename T>
|
||||
@@ -112,7 +112,7 @@ template <typename T>
|
||||
typename singleton_default<T>::object_creator
|
||||
singleton_default<T>::create_object;
|
||||
|
||||
} // namespace container_detail
|
||||
} // namespace dtl
|
||||
} // namespace container
|
||||
} // namespace boost
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@ class allocator;
|
||||
template<class T>
|
||||
struct less;
|
||||
|
||||
template<class T>
|
||||
struct equal_to;
|
||||
|
||||
template<class T1, class T2>
|
||||
struct pair;
|
||||
|
||||
|
||||
181
linx64/include/boost/container/detail/thread_mutex.hpp
Normal file
181
linx64/include/boost/container/detail/thread_mutex.hpp
Normal file
@@ -0,0 +1,181 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2018-2018. 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/interprocess for documentation.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This code is partially based on the lightweight mutex implemented
|
||||
// by Boost.SmartPtr:
|
||||
//
|
||||
// Copyright (c) 2002, 2003 Peter Dimov
|
||||
// Copyright (c) Microsoft Corporation 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)
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
#
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_CONTAINER_DETAIL_THREAD_MUTEX_HPP
|
||||
#define BOOST_CONTAINER_DETAIL_THREAD_MUTEX_HPP
|
||||
|
||||
#include <boost/container/detail/config_begin.hpp>
|
||||
#include <boost/container/detail/workaround.hpp>
|
||||
|
||||
#if defined(BOOST_HAS_PTHREADS)
|
||||
|
||||
#include <pthread.h>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost{
|
||||
namespace container {
|
||||
namespace dtl {
|
||||
|
||||
class thread_mutex
|
||||
{
|
||||
public:
|
||||
thread_mutex()
|
||||
{
|
||||
BOOST_VERIFY(pthread_mutex_init(&m_mut, 0) == 0);
|
||||
}
|
||||
|
||||
~thread_mutex()
|
||||
{
|
||||
BOOST_VERIFY(pthread_mutex_destroy(&m_mut) == 0);
|
||||
}
|
||||
|
||||
void lock()
|
||||
{
|
||||
BOOST_VERIFY(pthread_mutex_lock( &m_mut) == 0);
|
||||
}
|
||||
|
||||
void unlock()
|
||||
{
|
||||
BOOST_VERIFY(pthread_mutex_unlock(&m_mut) == 0);
|
||||
}
|
||||
|
||||
private:
|
||||
thread_mutex(thread_mutex const &);
|
||||
thread_mutex & operator=(thread_mutex const &);
|
||||
|
||||
pthread_mutex_t m_mut;
|
||||
};
|
||||
|
||||
} // namespace dtl {
|
||||
} // namespace container {
|
||||
} // namespace boost {
|
||||
|
||||
#else //!BOOST_HAS_PTHREADS (Windows implementation)
|
||||
|
||||
#ifdef BOOST_USE_WINDOWS_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
namespace boost{
|
||||
namespace container {
|
||||
namespace dtl {
|
||||
|
||||
typedef ::CRITICAL_SECTION win_critical_section;
|
||||
|
||||
} // namespace dtl {
|
||||
} // namespace container {
|
||||
} // namespace boost {
|
||||
|
||||
#else //! BOOST_USE_WINDOWS_H
|
||||
|
||||
struct _RTL_CRITICAL_SECTION_DEBUG;
|
||||
struct _RTL_CRITICAL_SECTION;
|
||||
|
||||
namespace boost{
|
||||
namespace container {
|
||||
namespace dtl {
|
||||
|
||||
#ifdef BOOST_PLAT_WINDOWS_UWP
|
||||
extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSectionEx(::_RTL_CRITICAL_SECTION *, unsigned long, unsigned long);
|
||||
#else
|
||||
extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(::_RTL_CRITICAL_SECTION *);
|
||||
#endif
|
||||
extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(::_RTL_CRITICAL_SECTION *);
|
||||
extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(::_RTL_CRITICAL_SECTION *);
|
||||
extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(::_RTL_CRITICAL_SECTION *);
|
||||
|
||||
struct win_critical_section
|
||||
{
|
||||
struct _RTL_CRITICAL_SECTION_DEBUG * DebugInfo;
|
||||
long LockCount;
|
||||
long RecursionCount;
|
||||
void * OwningThread;
|
||||
void * LockSemaphore;
|
||||
#if defined(_WIN64)
|
||||
unsigned __int64 SpinCount;
|
||||
#else
|
||||
unsigned long SpinCount;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace dtl {
|
||||
} // namespace container {
|
||||
} // namespace boost {
|
||||
|
||||
#endif //BOOST_USE_WINDOWS_H
|
||||
|
||||
namespace boost{
|
||||
namespace container {
|
||||
namespace dtl {
|
||||
|
||||
class thread_mutex
|
||||
{
|
||||
public:
|
||||
thread_mutex()
|
||||
{
|
||||
#ifdef BOOST_PLAT_WINDOWS_UWP
|
||||
InitializeCriticalSectionEx(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_crit_sect), 4000, 0);
|
||||
#else
|
||||
InitializeCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_crit_sect));
|
||||
#endif
|
||||
}
|
||||
|
||||
void lock()
|
||||
{
|
||||
EnterCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_crit_sect));
|
||||
}
|
||||
|
||||
void unlock()
|
||||
{
|
||||
LeaveCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_crit_sect));
|
||||
}
|
||||
|
||||
~thread_mutex()
|
||||
{
|
||||
DeleteCriticalSection(reinterpret_cast< ::_RTL_CRITICAL_SECTION* >(&m_crit_sect));
|
||||
}
|
||||
|
||||
private:
|
||||
thread_mutex(thread_mutex const &);
|
||||
thread_mutex & operator=(thread_mutex const &);
|
||||
|
||||
win_critical_section m_crit_sect;
|
||||
};
|
||||
|
||||
} // namespace dtl {
|
||||
} // namespace container {
|
||||
} // namespace boost {
|
||||
|
||||
#endif //BOOST_HAS_PTHREADS
|
||||
|
||||
#include <boost/container/detail/config_end.hpp>
|
||||
|
||||
#endif // #ifndef BOOST_CONTAINER_DETAIL_THREAD_MUTEX_HPP
|
||||
@@ -1,33 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2014-2015. 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_TO_RAW_POINTER_HPP
|
||||
#define BOOST_CONTAINER_DETAIL_TO_RAW_POINTER_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/intrusive/detail/to_raw_pointer.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
|
||||
using ::boost::intrusive::detail::to_raw_pointer;
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
#endif //#ifndef BOOST_CONTAINER_DETAIL_TO_RAW_POINTER_HPP
|
||||
@@ -63,7 +63,7 @@ class transform_iterator
|
||||
: public UnaryFunction
|
||||
, public boost::container::iterator
|
||||
< typename Iterator::iterator_category
|
||||
, typename container_detail::remove_reference<typename UnaryFunction::result_type>::type
|
||||
, typename dtl::remove_reference<typename UnaryFunction::result_type>::type
|
||||
, typename Iterator::difference_type
|
||||
, operator_arrow_proxy<typename UnaryFunction::result_type>
|
||||
, typename UnaryFunction::result_type>
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
using boost::intrusive::tree_value_compare;
|
||||
|
||||
@@ -71,38 +71,38 @@ struct intrusive_tree_hook;
|
||||
template<class VoidPointer, bool OptimizeSize>
|
||||
struct intrusive_tree_hook<VoidPointer, boost::container::red_black_tree, OptimizeSize>
|
||||
{
|
||||
typedef typename container_detail::bi::make_set_base_hook
|
||||
< container_detail::bi::void_pointer<VoidPointer>
|
||||
, container_detail::bi::link_mode<container_detail::bi::normal_link>
|
||||
, container_detail::bi::optimize_size<OptimizeSize>
|
||||
typedef typename dtl::bi::make_set_base_hook
|
||||
< dtl::bi::void_pointer<VoidPointer>
|
||||
, dtl::bi::link_mode<dtl::bi::normal_link>
|
||||
, dtl::bi::optimize_size<OptimizeSize>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool OptimizeSize>
|
||||
struct intrusive_tree_hook<VoidPointer, boost::container::avl_tree, OptimizeSize>
|
||||
{
|
||||
typedef typename container_detail::bi::make_avl_set_base_hook
|
||||
< container_detail::bi::void_pointer<VoidPointer>
|
||||
, container_detail::bi::link_mode<container_detail::bi::normal_link>
|
||||
, container_detail::bi::optimize_size<OptimizeSize>
|
||||
typedef typename dtl::bi::make_avl_set_base_hook
|
||||
< dtl::bi::void_pointer<VoidPointer>
|
||||
, dtl::bi::link_mode<dtl::bi::normal_link>
|
||||
, dtl::bi::optimize_size<OptimizeSize>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool OptimizeSize>
|
||||
struct intrusive_tree_hook<VoidPointer, boost::container::scapegoat_tree, OptimizeSize>
|
||||
{
|
||||
typedef typename container_detail::bi::make_bs_set_base_hook
|
||||
< container_detail::bi::void_pointer<VoidPointer>
|
||||
, container_detail::bi::link_mode<container_detail::bi::normal_link>
|
||||
typedef typename dtl::bi::make_bs_set_base_hook
|
||||
< dtl::bi::void_pointer<VoidPointer>
|
||||
, dtl::bi::link_mode<dtl::bi::normal_link>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template<class VoidPointer, bool OptimizeSize>
|
||||
struct intrusive_tree_hook<VoidPointer, boost::container::splay_tree, OptimizeSize>
|
||||
{
|
||||
typedef typename container_detail::bi::make_bs_set_base_hook
|
||||
< container_detail::bi::void_pointer<VoidPointer>
|
||||
, container_detail::bi::link_mode<container_detail::bi::normal_link>
|
||||
typedef typename dtl::bi::make_bs_set_base_hook
|
||||
< dtl::bi::void_pointer<VoidPointer>
|
||||
, dtl::bi::link_mode<dtl::bi::normal_link>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
@@ -125,10 +125,6 @@ template <class T, class VoidPointer, boost::container::tree_type_enum tree_type
|
||||
struct tree_node
|
||||
: public intrusive_tree_hook<VoidPointer, tree_type_value, OptimizeSize>::type
|
||||
{
|
||||
private:
|
||||
//BOOST_COPYABLE_AND_MOVABLE(tree_node)
|
||||
tree_node();
|
||||
|
||||
public:
|
||||
typedef typename intrusive_tree_hook
|
||||
<VoidPointer, tree_type_value, OptimizeSize>::type hook_type;
|
||||
@@ -138,55 +134,86 @@ struct tree_node
|
||||
typedef tree_node< T, VoidPointer
|
||||
, tree_type_value, OptimizeSize> node_t;
|
||||
|
||||
typedef typename boost::container::dtl::aligned_storage
|
||||
<sizeof(T), boost::container::dtl::alignment_of<T>::value>::type storage_t;
|
||||
storage_t m_storage;
|
||||
|
||||
#if defined(BOOST_GCC) && (BOOST_GCC >= 40600) && (BOOST_GCC < 80000)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
#define BOOST_CONTAINER_DISABLE_ALIASING_WARNING
|
||||
# endif
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE T &get_data()
|
||||
{
|
||||
T* ptr = reinterpret_cast<T*>(&this->m_data);
|
||||
return *ptr;
|
||||
}
|
||||
{ return *reinterpret_cast<T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const T &get_data() const
|
||||
{
|
||||
const T* ptr = reinterpret_cast<const T*>(&this->m_data);
|
||||
return *ptr;
|
||||
}
|
||||
{ return *reinterpret_cast<const T*>(this->m_storage.data); }
|
||||
|
||||
internal_type m_data;
|
||||
BOOST_CONTAINER_FORCEINLINE T *get_data_ptr()
|
||||
{ return reinterpret_cast<T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const T *get_data_ptr() const
|
||||
{ return reinterpret_cast<T*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE internal_type &get_real_data()
|
||||
{ return *reinterpret_cast<internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const internal_type &get_real_data() const
|
||||
{ return *reinterpret_cast<const internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE internal_type *get_real_data_ptr()
|
||||
{ return reinterpret_cast<internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const internal_type *get_real_data_ptr() const
|
||||
{ return reinterpret_cast<internal_type*>(this->m_storage.data); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE ~tree_node()
|
||||
{ reinterpret_cast<internal_type*>(this->m_storage.data)->~internal_type(); }
|
||||
|
||||
#if defined(BOOST_CONTAINER_DISABLE_ALIASING_WARNING)
|
||||
#pragma GCC diagnostic pop
|
||||
#undef BOOST_CONTAINER_DISABLE_ALIASING_WARNING
|
||||
# endif
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void destroy_header()
|
||||
{ static_cast<hook_type*>(this)->~hook_type(); }
|
||||
|
||||
template<class T1, class T2>
|
||||
BOOST_CONTAINER_FORCEINLINE void do_assign(const std::pair<const T1, T2> &p)
|
||||
{
|
||||
const_cast<T1&>(m_data.first) = p.first;
|
||||
m_data.second = p.second;
|
||||
const_cast<T1&>(this->get_real_data().first) = p.first;
|
||||
this->get_real_data().second = p.second;
|
||||
}
|
||||
|
||||
template<class T1, class T2>
|
||||
BOOST_CONTAINER_FORCEINLINE void do_assign(const pair<const T1, T2> &p)
|
||||
{
|
||||
const_cast<T1&>(m_data.first) = p.first;
|
||||
m_data.second = p.second;
|
||||
const_cast<T1&>(this->get_real_data().first) = p.first;
|
||||
this->get_real_data().second = p.second;
|
||||
}
|
||||
|
||||
template<class V>
|
||||
BOOST_CONTAINER_FORCEINLINE void do_assign(const V &v)
|
||||
{ m_data = v; }
|
||||
{ this->get_real_data() = v; }
|
||||
|
||||
template<class T1, class T2>
|
||||
BOOST_CONTAINER_FORCEINLINE void do_move_assign(std::pair<const T1, T2> &p)
|
||||
{
|
||||
const_cast<T1&>(m_data.first) = ::boost::move(p.first);
|
||||
m_data.second = ::boost::move(p.second);
|
||||
const_cast<T1&>(this->get_real_data().first) = ::boost::move(p.first);
|
||||
this->get_real_data().second = ::boost::move(p.second);
|
||||
}
|
||||
|
||||
template<class T1, class T2>
|
||||
BOOST_CONTAINER_FORCEINLINE void do_move_assign(pair<const T1, T2> &p)
|
||||
{
|
||||
const_cast<T1&>(m_data.first) = ::boost::move(p.first);
|
||||
m_data.second = ::boost::move(p.second);
|
||||
const_cast<T1&>(this->get_real_data().first) = ::boost::move(p.first);
|
||||
this->get_real_data().second = ::boost::move(p.second);
|
||||
}
|
||||
|
||||
template<class V>
|
||||
BOOST_CONTAINER_FORCEINLINE void do_move_assign(V &v)
|
||||
{ m_data = ::boost::move(v); }
|
||||
{ this->get_real_data() = ::boost::move(v); }
|
||||
};
|
||||
|
||||
template <class T, class VoidPointer, boost::container::tree_type_enum tree_type_value, bool OptimizeSize>
|
||||
@@ -222,9 +249,9 @@ class push_back_functor
|
||||
{ this->icont_.push_back(n); }
|
||||
};
|
||||
|
||||
}//namespace container_detail {
|
||||
}//namespace dtl {
|
||||
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
template< class NodeType, class NodeCompareType
|
||||
, class SizeType, class HookType
|
||||
@@ -235,12 +262,12 @@ template<class NodeType, class NodeCompareType, class SizeType, class HookType>
|
||||
struct intrusive_tree_dispatch
|
||||
<NodeType, NodeCompareType, SizeType, HookType, boost::container::red_black_tree>
|
||||
{
|
||||
typedef typename container_detail::bi::make_rbtree
|
||||
typedef typename dtl::bi::make_rbtree
|
||||
<NodeType
|
||||
,container_detail::bi::compare<NodeCompareType>
|
||||
,container_detail::bi::base_hook<HookType>
|
||||
,container_detail::bi::constant_time_size<true>
|
||||
,container_detail::bi::size_type<SizeType>
|
||||
,dtl::bi::compare<NodeCompareType>
|
||||
,dtl::bi::base_hook<HookType>
|
||||
,dtl::bi::constant_time_size<true>
|
||||
,dtl::bi::size_type<SizeType>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
@@ -248,12 +275,12 @@ template<class NodeType, class NodeCompareType, class SizeType, class HookType>
|
||||
struct intrusive_tree_dispatch
|
||||
<NodeType, NodeCompareType, SizeType, HookType, boost::container::avl_tree>
|
||||
{
|
||||
typedef typename container_detail::bi::make_avltree
|
||||
typedef typename dtl::bi::make_avltree
|
||||
<NodeType
|
||||
,container_detail::bi::compare<NodeCompareType>
|
||||
,container_detail::bi::base_hook<HookType>
|
||||
,container_detail::bi::constant_time_size<true>
|
||||
,container_detail::bi::size_type<SizeType>
|
||||
,dtl::bi::compare<NodeCompareType>
|
||||
,dtl::bi::base_hook<HookType>
|
||||
,dtl::bi::constant_time_size<true>
|
||||
,dtl::bi::size_type<SizeType>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
@@ -261,12 +288,12 @@ template<class NodeType, class NodeCompareType, class SizeType, class HookType>
|
||||
struct intrusive_tree_dispatch
|
||||
<NodeType, NodeCompareType, SizeType, HookType, boost::container::scapegoat_tree>
|
||||
{
|
||||
typedef typename container_detail::bi::make_sgtree
|
||||
typedef typename dtl::bi::make_sgtree
|
||||
<NodeType
|
||||
,container_detail::bi::compare<NodeCompareType>
|
||||
,container_detail::bi::base_hook<HookType>
|
||||
,container_detail::bi::floating_point<true>
|
||||
,container_detail::bi::size_type<SizeType>
|
||||
,dtl::bi::compare<NodeCompareType>
|
||||
,dtl::bi::base_hook<HookType>
|
||||
,dtl::bi::floating_point<true>
|
||||
,dtl::bi::size_type<SizeType>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
@@ -274,12 +301,12 @@ template<class NodeType, class NodeCompareType, class SizeType, class HookType>
|
||||
struct intrusive_tree_dispatch
|
||||
<NodeType, NodeCompareType, SizeType, HookType, boost::container::splay_tree>
|
||||
{
|
||||
typedef typename container_detail::bi::make_splaytree
|
||||
typedef typename dtl::bi::make_splaytree
|
||||
<NodeType
|
||||
,container_detail::bi::compare<NodeCompareType>
|
||||
,container_detail::bi::base_hook<HookType>
|
||||
,container_detail::bi::constant_time_size<true>
|
||||
,container_detail::bi::size_type<SizeType>
|
||||
,dtl::bi::compare<NodeCompareType>
|
||||
,dtl::bi::base_hook<HookType>
|
||||
,dtl::bi::constant_time_size<true>
|
||||
,dtl::bi::size_type<SizeType>
|
||||
>::type type;
|
||||
};
|
||||
|
||||
@@ -293,7 +320,7 @@ struct intrusive_tree_type
|
||||
allocator_traits<Allocator>::void_pointer void_pointer;
|
||||
typedef typename boost::container::
|
||||
allocator_traits<Allocator>::size_type size_type;
|
||||
typedef typename container_detail::tree_node
|
||||
typedef typename dtl::tree_node
|
||||
< value_type, void_pointer
|
||||
, tree_type_value, OptimizeSize> node_t;
|
||||
typedef value_to_node_compare
|
||||
@@ -340,9 +367,9 @@ struct intrusive_tree_proxy<tree_type_value, true>
|
||||
{ c.rebalance(); }
|
||||
};
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
//This functor will be used with Intrusive clone functions to obtain
|
||||
//already allocated nodes from a intrusive container instead of
|
||||
@@ -361,10 +388,10 @@ class RecyclingCloner
|
||||
{}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE static void do_assign(node_ptr_type &p, const node_t &other, bool_<true>)
|
||||
{ p->do_move_assign(const_cast<node_t &>(other).m_data); }
|
||||
{ p->do_move_assign(const_cast<node_t &>(other).get_real_data()); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE static void do_assign(node_ptr_type &p, const node_t &other, bool_<false>)
|
||||
{ p->do_assign(other.m_data); }
|
||||
{ p->do_assign(other.get_real_data()); }
|
||||
|
||||
node_ptr_type operator()(const node_t &other) const
|
||||
{
|
||||
@@ -386,7 +413,7 @@ class RecyclingCloner
|
||||
BOOST_CATCH_END
|
||||
}
|
||||
else{
|
||||
return m_holder.create_node(other.m_data);
|
||||
return m_holder.create_node(other.get_real_data());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,6 +421,7 @@ class RecyclingCloner
|
||||
intrusive_container &m_icont;
|
||||
};
|
||||
|
||||
|
||||
template<class KeyCompare, class KeyOfValue>
|
||||
struct key_node_compare
|
||||
: public boost::intrusive::detail::ebo_functor_holder<KeyCompare>
|
||||
@@ -407,6 +435,21 @@ struct key_node_compare
|
||||
typedef KeyOfValue key_of_value;
|
||||
typedef typename KeyOfValue::type key_type;
|
||||
|
||||
|
||||
template <class T, class VoidPointer, boost::container::tree_type_enum tree_type_value, bool OptimizeSize>
|
||||
BOOST_CONTAINER_FORCEINLINE static const key_type &
|
||||
key_from(const tree_node<T, VoidPointer, tree_type_value, OptimizeSize> &n)
|
||||
{
|
||||
return key_of_value()(n.get_data());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
BOOST_CONTAINER_FORCEINLINE static const T &
|
||||
key_from(const T &t)
|
||||
{
|
||||
return t;
|
||||
}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const key_compare &key_comp() const
|
||||
{ return static_cast<const key_compare &>(*this); }
|
||||
|
||||
@@ -418,40 +461,88 @@ struct key_node_compare
|
||||
|
||||
template<class U>
|
||||
BOOST_CONTAINER_FORCEINLINE bool operator()(const key_type &key1, const U &nonkey2) const
|
||||
{ return this->key_comp()(key1, key_of_value()(nonkey2.get_data())); }
|
||||
{ return this->key_comp()(key1, this->key_from(nonkey2)); }
|
||||
|
||||
template<class U>
|
||||
BOOST_CONTAINER_FORCEINLINE bool operator()(const U &nonkey1, const key_type &key2) const
|
||||
{ return this->key_comp()(key_of_value()(nonkey1.get_data()), key2); }
|
||||
{ return this->key_comp()(this->key_from(nonkey1), key2); }
|
||||
|
||||
template<class U, class V>
|
||||
BOOST_CONTAINER_FORCEINLINE bool operator()(const U &nonkey1, const V &nonkey2) const
|
||||
{ return this->key_comp()(key_of_value()(nonkey1.get_data()), key_of_value()(nonkey2.get_data())); }
|
||||
{ return this->key_comp()(this->key_from(nonkey1), this->key_from(nonkey2)); }
|
||||
};
|
||||
|
||||
template <class T, class KeyOfValue,
|
||||
class Compare, class Allocator,
|
||||
class Options = tree_assoc_defaults>
|
||||
template<class Options>
|
||||
struct get_tree_opt
|
||||
{
|
||||
typedef Options type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct get_tree_opt<void>
|
||||
{
|
||||
typedef tree_assoc_defaults type;
|
||||
};
|
||||
|
||||
template<class, class KeyOfValue>
|
||||
struct real_key_of_value
|
||||
{
|
||||
typedef KeyOfValue type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct real_key_of_value<T, void>
|
||||
{
|
||||
typedef dtl::identity<T> type;
|
||||
};
|
||||
|
||||
template<class T1, class T2>
|
||||
struct real_key_of_value<std::pair<T1, T2>, int>
|
||||
{
|
||||
typedef dtl::select1st<T1> type;
|
||||
};
|
||||
|
||||
template<class T1, class T2>
|
||||
struct real_key_of_value<boost::container::pair<T1, T2>, int>
|
||||
{
|
||||
typedef dtl::select1st<T1> type;
|
||||
};
|
||||
|
||||
template <class T, class KeyOfValue, class Compare, class Allocator, class Options>
|
||||
class tree
|
||||
: public container_detail::node_alloc_holder
|
||||
< Allocator
|
||||
, typename container_detail::intrusive_tree_type
|
||||
< Allocator, tree_value_compare
|
||||
<typename allocator_traits<Allocator>::pointer, Compare, KeyOfValue>
|
||||
, Options::tree_type, Options::optimize_size>::type
|
||||
: public dtl::node_alloc_holder
|
||||
< typename real_allocator<T, Allocator>::type
|
||||
, typename dtl::intrusive_tree_type
|
||||
< typename real_allocator<T, Allocator>::type
|
||||
, tree_value_compare
|
||||
<typename allocator_traits<typename real_allocator<T, Allocator>::type>::pointer, Compare, typename real_key_of_value<T, KeyOfValue>::type>
|
||||
, get_tree_opt<Options>::type::tree_type
|
||||
, get_tree_opt<Options>::type::optimize_size
|
||||
>::type
|
||||
>
|
||||
{
|
||||
typedef tree_value_compare
|
||||
< typename allocator_traits<Allocator>::pointer
|
||||
, Compare, KeyOfValue> ValComp;
|
||||
typedef typename container_detail::intrusive_tree_type
|
||||
< Allocator, ValComp, Options::tree_type
|
||||
, Options::optimize_size>::type Icont;
|
||||
typedef container_detail::node_alloc_holder
|
||||
<Allocator, Icont> AllocHolder;
|
||||
typedef typename AllocHolder::NodePtr NodePtr;
|
||||
typedef tree < T, KeyOfValue
|
||||
, Compare, Allocator, Options> ThisType;
|
||||
public:
|
||||
typedef typename real_allocator<T, Allocator>::type allocator_type;
|
||||
|
||||
private:
|
||||
typedef allocator_traits<allocator_type> allocator_traits_t;
|
||||
typedef typename real_key_of_value<T, KeyOfValue>::type key_of_value_t;
|
||||
typedef tree_value_compare
|
||||
< typename allocator_traits_t::pointer
|
||||
, Compare
|
||||
, key_of_value_t> ValComp;
|
||||
typedef typename get_tree_opt<Options>::type options_type;
|
||||
typedef typename dtl::intrusive_tree_type
|
||||
< allocator_type, ValComp
|
||||
, options_type::tree_type
|
||||
, options_type::optimize_size
|
||||
>::type Icont;
|
||||
typedef dtl::node_alloc_holder
|
||||
<allocator_type, Icont> AllocHolder;
|
||||
typedef typename AllocHolder::NodePtr NodePtr;
|
||||
|
||||
typedef typename AllocHolder::NodeAlloc NodeAlloc;
|
||||
typedef boost::container::
|
||||
allocator_traits<NodeAlloc> allocator_traits_type;
|
||||
@@ -459,49 +550,48 @@ class tree
|
||||
typedef typename AllocHolder::Node Node;
|
||||
typedef typename Icont::iterator iiterator;
|
||||
typedef typename Icont::const_iterator iconst_iterator;
|
||||
typedef container_detail::allocator_destroyer<NodeAlloc> Destroyer;
|
||||
typedef dtl::allocator_destroyer<NodeAlloc> Destroyer;
|
||||
typedef typename AllocHolder::alloc_version alloc_version;
|
||||
typedef intrusive_tree_proxy<Options::tree_type> intrusive_tree_proxy_t;
|
||||
typedef intrusive_tree_proxy<options_type::tree_type> intrusive_tree_proxy_t;
|
||||
|
||||
BOOST_COPYABLE_AND_MOVABLE(tree)
|
||||
|
||||
public:
|
||||
|
||||
typedef typename KeyOfValue::type key_type;
|
||||
typedef T value_type;
|
||||
typedef Allocator allocator_type;
|
||||
typedef Compare key_compare;
|
||||
typedef ValComp value_compare;
|
||||
typedef typename key_of_value_t::type key_type;
|
||||
typedef T value_type;
|
||||
typedef Compare key_compare;
|
||||
typedef ValComp value_compare;
|
||||
typedef typename boost::container::
|
||||
allocator_traits<Allocator>::pointer pointer;
|
||||
allocator_traits<allocator_type>::pointer pointer;
|
||||
typedef typename boost::container::
|
||||
allocator_traits<Allocator>::const_pointer const_pointer;
|
||||
allocator_traits<allocator_type>::const_pointer const_pointer;
|
||||
typedef typename boost::container::
|
||||
allocator_traits<Allocator>::reference reference;
|
||||
allocator_traits<allocator_type>::reference reference;
|
||||
typedef typename boost::container::
|
||||
allocator_traits<Allocator>::const_reference const_reference;
|
||||
allocator_traits<allocator_type>::const_reference const_reference;
|
||||
typedef typename boost::container::
|
||||
allocator_traits<Allocator>::size_type size_type;
|
||||
allocator_traits<allocator_type>::size_type size_type;
|
||||
typedef typename boost::container::
|
||||
allocator_traits<Allocator>::difference_type difference_type;
|
||||
typedef container_detail::iterator_from_iiterator
|
||||
<iiterator, false> iterator;
|
||||
typedef container_detail::iterator_from_iiterator
|
||||
<iiterator, true > const_iterator;
|
||||
allocator_traits<allocator_type>::difference_type difference_type;
|
||||
typedef dtl::iterator_from_iiterator
|
||||
<iiterator, false> iterator;
|
||||
typedef dtl::iterator_from_iiterator
|
||||
<iiterator, true > const_iterator;
|
||||
typedef boost::container::reverse_iterator
|
||||
<iterator> reverse_iterator;
|
||||
<iterator> reverse_iterator;
|
||||
typedef boost::container::reverse_iterator
|
||||
<const_iterator> const_reverse_iterator;
|
||||
<const_iterator> const_reverse_iterator;
|
||||
typedef node_handle
|
||||
< Node, value_type, allocator_type, void> node_type;
|
||||
< NodeAlloc, void> node_type;
|
||||
typedef insert_return_type_base
|
||||
<iterator, node_type> insert_return_type;
|
||||
<iterator, node_type> insert_return_type;
|
||||
|
||||
typedef NodeAlloc stored_allocator_type;
|
||||
typedef NodeAlloc stored_allocator_type;
|
||||
|
||||
private:
|
||||
|
||||
typedef key_node_compare<key_compare, KeyOfValue> KeyNodeCompare;
|
||||
typedef key_node_compare<key_compare, key_of_value_t> KeyNodeCompare;
|
||||
|
||||
public:
|
||||
|
||||
@@ -509,7 +599,11 @@ class tree
|
||||
: AllocHolder()
|
||||
{}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE explicit tree(const key_compare& comp, const allocator_type& a = allocator_type())
|
||||
BOOST_CONTAINER_FORCEINLINE explicit tree(const key_compare& comp)
|
||||
: AllocHolder(ValComp(comp))
|
||||
{}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE explicit tree(const key_compare& comp, const allocator_type& a)
|
||||
: AllocHolder(ValComp(comp), a)
|
||||
{}
|
||||
|
||||
@@ -518,110 +612,153 @@ class tree
|
||||
{}
|
||||
|
||||
template <class InputIterator>
|
||||
tree(bool unique_insertion, InputIterator first, InputIterator last, const key_compare& comp,
|
||||
const allocator_type& a
|
||||
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
, typename container_detail::enable_if_or
|
||||
< void
|
||||
, container_detail::is_same<alloc_version, version_1>
|
||||
, container_detail::is_input_iterator<InputIterator>
|
||||
>::type * = 0
|
||||
#endif
|
||||
)
|
||||
tree(bool unique_insertion, InputIterator first, InputIterator last)
|
||||
: AllocHolder(value_compare(key_compare()))
|
||||
{
|
||||
this->tree_construct(unique_insertion, first, last);
|
||||
//AllocHolder clears in case of exception
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
tree(bool unique_insertion, InputIterator first, InputIterator last, const key_compare& comp)
|
||||
: AllocHolder(value_compare(comp))
|
||||
{
|
||||
this->tree_construct(unique_insertion, first, last);
|
||||
//AllocHolder clears in case of exception
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
tree(bool unique_insertion, InputIterator first, InputIterator last, const key_compare& comp, const allocator_type& a)
|
||||
: AllocHolder(value_compare(comp), a)
|
||||
{
|
||||
this->tree_construct(unique_insertion, first, last);
|
||||
//AllocHolder clears in case of exception
|
||||
}
|
||||
|
||||
//construct with ordered range
|
||||
template <class InputIterator>
|
||||
tree( ordered_range_t, InputIterator first, InputIterator last)
|
||||
: AllocHolder(value_compare(key_compare()))
|
||||
{
|
||||
this->tree_construct(ordered_range_t(), first, last);
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
tree( ordered_range_t, InputIterator first, InputIterator last, const key_compare& comp)
|
||||
: AllocHolder(value_compare(comp))
|
||||
{
|
||||
this->tree_construct(ordered_range_t(), first, last);
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
tree( ordered_range_t, InputIterator first, InputIterator last
|
||||
, const key_compare& comp, const allocator_type& a)
|
||||
: AllocHolder(value_compare(comp), a)
|
||||
{
|
||||
this->tree_construct(ordered_range_t(), first, last);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
template <class InputIterator>
|
||||
void tree_construct(bool unique_insertion, InputIterator first, InputIterator last)
|
||||
{
|
||||
//Use cend() as hint to achieve linear time for
|
||||
//ordered ranges as required by the standard
|
||||
//for the constructor
|
||||
const const_iterator end_it(this->cend());
|
||||
if(unique_insertion){
|
||||
for ( ; first != last; ++first){
|
||||
this->insert_unique_convertible(end_it, *first);
|
||||
}
|
||||
}
|
||||
else{
|
||||
for ( ; first != last; ++first){
|
||||
this->insert_equal_convertible(end_it, *first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
tree(bool unique_insertion, InputIterator first, InputIterator last, const key_compare& comp,
|
||||
const allocator_type& a
|
||||
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
, typename container_detail::disable_if_or
|
||||
< void
|
||||
, container_detail::is_same<alloc_version, version_1>
|
||||
, container_detail::is_input_iterator<InputIterator>
|
||||
>::type * = 0
|
||||
#endif
|
||||
)
|
||||
: AllocHolder(value_compare(comp), a)
|
||||
{
|
||||
if(unique_insertion){
|
||||
//Use cend() as hint to achieve linear time for
|
||||
//ordered ranges as required by the standard
|
||||
//for the constructor
|
||||
const const_iterator end_it(this->cend());
|
||||
for ( ; first != last; ++first){
|
||||
this->insert_unique_convertible(end_it, *first);
|
||||
}
|
||||
}
|
||||
else{
|
||||
//Optimized allocation and construction
|
||||
this->allocate_many_and_construct
|
||||
( first, boost::container::iterator_distance(first, last)
|
||||
, insert_equal_end_hint_functor<Node, Icont>(this->icont()));
|
||||
this->tree_construct_non_unique(first, last);
|
||||
}
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
tree( ordered_range_t, InputIterator first, InputIterator last
|
||||
, const key_compare& comp = key_compare(), const allocator_type& a = allocator_type()
|
||||
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
, typename container_detail::enable_if_or
|
||||
void tree_construct_non_unique(InputIterator first, InputIterator last
|
||||
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
, typename dtl::enable_if_or
|
||||
< void
|
||||
, container_detail::is_same<alloc_version, version_1>
|
||||
, container_detail::is_input_iterator<InputIterator>
|
||||
, dtl::is_same<alloc_version, version_1>
|
||||
, dtl::is_input_iterator<InputIterator>
|
||||
>::type * = 0
|
||||
#endif
|
||||
)
|
||||
{
|
||||
//Use cend() as hint to achieve linear time for
|
||||
//ordered ranges as required by the standard
|
||||
//for the constructor
|
||||
const const_iterator end_it(this->cend());
|
||||
for ( ; first != last; ++first){
|
||||
this->insert_equal_convertible(end_it, *first);
|
||||
}
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
void tree_construct_non_unique(InputIterator first, InputIterator last
|
||||
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
, typename dtl::disable_if_or
|
||||
< void
|
||||
, dtl::is_same<alloc_version, version_1>
|
||||
, dtl::is_input_iterator<InputIterator>
|
||||
>::type * = 0
|
||||
#endif
|
||||
)
|
||||
{
|
||||
//Optimized allocation and construction
|
||||
this->allocate_many_and_construct
|
||||
( first, boost::container::iterator_distance(first, last)
|
||||
, insert_equal_end_hint_functor<Node, Icont>(this->icont()));
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
void tree_construct( ordered_range_t, InputIterator first, InputIterator last
|
||||
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
, typename dtl::disable_if_or
|
||||
< void
|
||||
, dtl::is_same<alloc_version, version_1>
|
||||
, dtl::is_input_iterator<InputIterator>
|
||||
>::type * = 0
|
||||
#endif
|
||||
)
|
||||
{
|
||||
//Optimized allocation and construction
|
||||
this->allocate_many_and_construct
|
||||
( first, boost::container::iterator_distance(first, last)
|
||||
, dtl::push_back_functor<Node, Icont>(this->icont()));
|
||||
//AllocHolder clears in case of exception
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
void tree_construct( ordered_range_t, InputIterator first, InputIterator last
|
||||
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
, typename dtl::enable_if_or
|
||||
< void
|
||||
, dtl::is_same<alloc_version, version_1>
|
||||
, dtl::is_input_iterator<InputIterator>
|
||||
>::type * = 0
|
||||
#endif
|
||||
)
|
||||
: AllocHolder(value_compare(comp), a)
|
||||
{
|
||||
for ( ; first != last; ++first){
|
||||
this->push_back_impl(*first);
|
||||
}
|
||||
}
|
||||
|
||||
template <class InputIterator>
|
||||
tree( ordered_range_t, InputIterator first, InputIterator last
|
||||
, const key_compare& comp = key_compare(), const allocator_type& a = allocator_type()
|
||||
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
, typename container_detail::disable_if_or
|
||||
< void
|
||||
, container_detail::is_same<alloc_version, version_1>
|
||||
, container_detail::is_input_iterator<InputIterator>
|
||||
>::type * = 0
|
||||
#endif
|
||||
)
|
||||
: AllocHolder(value_compare(comp), a)
|
||||
{
|
||||
//Optimized allocation and construction
|
||||
this->allocate_many_and_construct
|
||||
( first, boost::container::iterator_distance(first, last)
|
||||
, container_detail::push_back_functor<Node, Icont>(this->icont()));
|
||||
}
|
||||
public:
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE tree(const tree& x)
|
||||
: AllocHolder(x.value_comp(), x)
|
||||
: AllocHolder(x, x.value_comp())
|
||||
{
|
||||
this->icont().clone_from
|
||||
(x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc()));
|
||||
}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE tree(BOOST_RV_REF(tree) x)
|
||||
BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible<Compare>::value)
|
||||
BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible<Compare>::value)
|
||||
: AllocHolder(BOOST_MOVE_BASE(AllocHolder, x), x.value_comp())
|
||||
{}
|
||||
|
||||
@@ -630,6 +767,7 @@ class tree
|
||||
{
|
||||
this->icont().clone_from
|
||||
(x.icont(), typename AllocHolder::cloner(*this), Destroyer(this->node_alloc()));
|
||||
//AllocHolder clears in case of exception
|
||||
}
|
||||
|
||||
tree(BOOST_RV_REF(tree) x, const allocator_type &a)
|
||||
@@ -642,6 +780,7 @@ class tree
|
||||
this->icont().clone_from
|
||||
(boost::move(x.icont()), typename AllocHolder::move_cloner(*this), Destroyer(this->node_alloc()));
|
||||
}
|
||||
//AllocHolder clears in case of exception
|
||||
}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE ~tree()
|
||||
@@ -652,7 +791,7 @@ class tree
|
||||
if (&x != this){
|
||||
NodeAlloc &this_alloc = this->get_stored_allocator();
|
||||
const NodeAlloc &x_alloc = x.get_stored_allocator();
|
||||
container_detail::bool_<allocator_traits<NodeAlloc>::
|
||||
dtl::bool_<allocator_traits<NodeAlloc>::
|
||||
propagate_on_container_copy_assignment::value> flag;
|
||||
if(flag && this_alloc != x_alloc){
|
||||
this->clear();
|
||||
@@ -681,7 +820,7 @@ class tree
|
||||
tree& operator=(BOOST_RV_REF(tree) x)
|
||||
BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value ||
|
||||
allocator_traits_type::is_always_equal::value) &&
|
||||
boost::container::container_detail::is_nothrow_move_assignable<Compare>::value)
|
||||
boost::container::dtl::is_nothrow_move_assignable<Compare>::value)
|
||||
{
|
||||
BOOST_ASSERT(this != &x);
|
||||
NodeAlloc &this_alloc = this->node_alloc();
|
||||
@@ -807,7 +946,7 @@ class tree
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void swap(ThisType& x)
|
||||
BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
|
||||
&& boost::container::container_detail::is_nothrow_swappable<Compare>::value )
|
||||
&& boost::container::dtl::is_nothrow_swappable<Compare>::value )
|
||||
{ AllocHolder::swap(x); }
|
||||
|
||||
public:
|
||||
@@ -848,7 +987,7 @@ class tree
|
||||
{
|
||||
insert_commit_data data;
|
||||
std::pair<iterator,bool> ret =
|
||||
this->insert_unique_check(KeyOfValue()(v), data);
|
||||
this->insert_unique_check(key_of_value_t()(v), data);
|
||||
if(ret.second){
|
||||
ret.first = this->insert_unique_commit(boost::forward<MovableConvertible>(v), data);
|
||||
}
|
||||
@@ -891,7 +1030,7 @@ class tree
|
||||
insert_commit_data data;
|
||||
scoped_destroy_deallocator<NodeAlloc> destroy_deallocator(p, this->node_alloc());
|
||||
std::pair<iterator,bool> ret =
|
||||
this->insert_unique_check(KeyOfValue()(v), data);
|
||||
this->insert_unique_check(key_of_value_t()(v), data);
|
||||
if(!ret.second){
|
||||
return ret;
|
||||
}
|
||||
@@ -908,7 +1047,7 @@ class tree
|
||||
value_type &v = p->get_data();
|
||||
insert_commit_data data;
|
||||
std::pair<iterator,bool> ret =
|
||||
this->insert_unique_check(hint, KeyOfValue()(v), data);
|
||||
this->insert_unique_check(hint, key_of_value_t()(v), data);
|
||||
if(!ret.second){
|
||||
Destroyer(this->node_alloc())(p);
|
||||
return ret.first;
|
||||
@@ -1024,7 +1163,7 @@ class tree
|
||||
BOOST_ASSERT((priv_is_linked)(hint));
|
||||
insert_commit_data data;
|
||||
std::pair<iterator,bool> ret =
|
||||
this->insert_unique_check(hint, KeyOfValue()(v), data);
|
||||
this->insert_unique_check(hint, key_of_value_t()(v), data);
|
||||
if(!ret.second)
|
||||
return ret.first;
|
||||
return this->insert_unique_commit(boost::forward<MovableConvertible>(v), data);
|
||||
@@ -1139,10 +1278,10 @@ class tree
|
||||
if(!nh.empty()){
|
||||
insert_commit_data data;
|
||||
std::pair<iterator,bool> ret =
|
||||
this->insert_unique_check(hint, KeyOfValue()(nh.value()), data);
|
||||
this->insert_unique_check(hint, key_of_value_t()(nh.value()), data);
|
||||
if(ret.second){
|
||||
irt.inserted = true;
|
||||
irt.position = iterator(this->icont().insert_unique_commit(*nh.get_node_pointer(), data));
|
||||
irt.position = iterator(this->icont().insert_unique_commit(*nh.get(), data));
|
||||
nh.release();
|
||||
}
|
||||
else{
|
||||
@@ -1196,21 +1335,72 @@ class tree
|
||||
BOOST_CONTAINER_FORCEINLINE const_iterator find(const key_type& k) const
|
||||
{ return const_iterator(this->non_const_icont().find(k, KeyNodeCompare(key_comp()))); }
|
||||
|
||||
template <class K>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
typename dtl::enable_if_transparent<key_compare, K, iterator>::type
|
||||
find(const K& k)
|
||||
{ return iterator(this->icont().find(k, KeyNodeCompare(key_comp()))); }
|
||||
|
||||
template <class K>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
typename dtl::enable_if_transparent<key_compare, K, const_iterator>::type
|
||||
find(const K& k) const
|
||||
{ return const_iterator(this->non_const_icont().find(k, KeyNodeCompare(key_comp()))); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& k) const
|
||||
{ return size_type(this->icont().count(k, KeyNodeCompare(key_comp()))); }
|
||||
|
||||
template <class K>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
typename dtl::enable_if_transparent<key_compare, K, size_type>::type
|
||||
count(const K& k) const
|
||||
{ return size_type(this->icont().count(k, KeyNodeCompare(key_comp()))); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE bool contains(const key_type& x) const
|
||||
{ return this->find(x) != this->cend(); }
|
||||
|
||||
template<typename K>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
typename dtl::enable_if_transparent<key_compare, K, bool>::type
|
||||
contains(const K& x) const
|
||||
{ return this->find(x) != this->cend(); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const key_type& k)
|
||||
{ return iterator(this->icont().lower_bound(k, KeyNodeCompare(key_comp()))); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const key_type& k) const
|
||||
{ return const_iterator(this->non_const_icont().lower_bound(k, KeyNodeCompare(key_comp()))); }
|
||||
|
||||
template <class K>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
typename dtl::enable_if_transparent<key_compare, K, iterator>::type
|
||||
lower_bound(const K& k)
|
||||
{ return iterator(this->icont().lower_bound(k, KeyNodeCompare(key_comp()))); }
|
||||
|
||||
template <class K>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
typename dtl::enable_if_transparent<key_compare, K, const_iterator>::type
|
||||
lower_bound(const K& k) const
|
||||
{ return const_iterator(this->non_const_icont().lower_bound(k, KeyNodeCompare(key_comp()))); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const key_type& k)
|
||||
{ return iterator(this->icont().upper_bound(k, KeyNodeCompare(key_comp()))); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const key_type& k) const
|
||||
{ return const_iterator(this->non_const_icont().upper_bound(k, KeyNodeCompare(key_comp()))); }
|
||||
|
||||
template <class K>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
typename dtl::enable_if_transparent<key_compare, K, iterator>::type
|
||||
upper_bound(const K& k)
|
||||
{ return iterator(this->icont().upper_bound(k, KeyNodeCompare(key_comp()))); }
|
||||
|
||||
template <class K>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
typename dtl::enable_if_transparent<key_compare, K, const_iterator>::type
|
||||
upper_bound(const K& k) const
|
||||
{ return const_iterator(this->non_const_icont().upper_bound(k, KeyNodeCompare(key_comp()))); }
|
||||
|
||||
std::pair<iterator,iterator> equal_range(const key_type& k)
|
||||
{
|
||||
std::pair<iiterator, iiterator> ret =
|
||||
@@ -1226,6 +1416,27 @@ class tree
|
||||
(const_iterator(ret.first), const_iterator(ret.second));
|
||||
}
|
||||
|
||||
template <class K>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
typename dtl::enable_if_transparent<key_compare, K, std::pair<iterator,iterator> >::type
|
||||
equal_range(const K& k)
|
||||
{
|
||||
std::pair<iiterator, iiterator> ret =
|
||||
this->icont().equal_range(k, KeyNodeCompare(key_comp()));
|
||||
return std::pair<iterator,iterator>(iterator(ret.first), iterator(ret.second));
|
||||
}
|
||||
|
||||
template <class K>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
typename dtl::enable_if_transparent<key_compare, K, std::pair<const_iterator, const_iterator> >::type
|
||||
equal_range(const K& k) const
|
||||
{
|
||||
std::pair<iiterator, iiterator> ret =
|
||||
this->non_const_icont().equal_range(k, KeyNodeCompare(key_comp()));
|
||||
return std::pair<const_iterator,const_iterator>
|
||||
(const_iterator(ret.first), const_iterator(ret.second));
|
||||
}
|
||||
|
||||
std::pair<iterator,iterator> lower_bound_range(const key_type& k)
|
||||
{
|
||||
std::pair<iiterator, iiterator> ret =
|
||||
@@ -1241,6 +1452,27 @@ class tree
|
||||
(const_iterator(ret.first), const_iterator(ret.second));
|
||||
}
|
||||
|
||||
template <class K>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
typename dtl::enable_if_transparent<key_compare, K, std::pair<iterator,iterator> >::type
|
||||
lower_bound_range(const K& k)
|
||||
{
|
||||
std::pair<iiterator, iiterator> ret =
|
||||
this->icont().lower_bound_range(k, KeyNodeCompare(key_comp()));
|
||||
return std::pair<iterator,iterator>(iterator(ret.first), iterator(ret.second));
|
||||
}
|
||||
|
||||
template <class K>
|
||||
BOOST_CONTAINER_FORCEINLINE
|
||||
typename dtl::enable_if_transparent<key_compare, K, std::pair<const_iterator, const_iterator> >::type
|
||||
lower_bound_range(const K& k) const
|
||||
{
|
||||
std::pair<iiterator, iiterator> ret =
|
||||
this->non_const_icont().lower_bound_range(k, KeyNodeCompare(key_comp()));
|
||||
return std::pair<const_iterator,const_iterator>
|
||||
(const_iterator(ret.first), const_iterator(ret.second));
|
||||
}
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE void rebalance()
|
||||
{ intrusive_tree_proxy_t::rebalance(this->icont()); }
|
||||
|
||||
@@ -1263,10 +1495,12 @@ class tree
|
||||
{ return !(x < y); }
|
||||
|
||||
BOOST_CONTAINER_FORCEINLINE friend void swap(tree& x, tree& y)
|
||||
BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
|
||||
&& boost::container::dtl::is_nothrow_swappable<Compare>::value )
|
||||
{ x.swap(y); }
|
||||
};
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
|
||||
template <class T>
|
||||
@@ -1277,7 +1511,7 @@ struct has_trivial_destructor_after_move;
|
||||
template <class T, class KeyOfValue, class Compare, class Allocator, class Options>
|
||||
struct has_trivial_destructor_after_move
|
||||
<
|
||||
::boost::container::container_detail::tree
|
||||
::boost::container::dtl::tree
|
||||
<T, KeyOfValue, Compare, Allocator, Options>
|
||||
>
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
using ::boost::move_detail::enable_if;
|
||||
using ::boost::move_detail::enable_if_and;
|
||||
@@ -61,9 +61,11 @@ using ::boost::move_detail::is_nothrow_swappable;
|
||||
using ::boost::move_detail::alignment_of;
|
||||
using ::boost::move_detail::aligned_storage;
|
||||
using ::boost::move_detail::nat;
|
||||
using ::boost::move_detail::nat2;
|
||||
using ::boost::move_detail::nat3;
|
||||
using ::boost::move_detail::max_align_t;
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
36
linx64/include/boost/container/detail/value_functors.hpp
Normal file
36
linx64/include/boost/container/detail/value_functors.hpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef BOOST_CONTAINER_DETAIL_VALUE_FUNCTORS_HPP
|
||||
#define BOOST_CONTAINER_DETAIL_VALUE_FUNCTORS_HPP
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// (C) Copyright Ion Gaztanaga 2017-2017. 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_CONFIG_HPP
|
||||
# include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//Functors for member algorithm defaults
|
||||
template<class ValueType>
|
||||
struct value_less
|
||||
{
|
||||
bool operator()(const ValueType &a, const ValueType &b) const
|
||||
{ return a < b; }
|
||||
};
|
||||
|
||||
template<class ValueType>
|
||||
struct value_equal
|
||||
{
|
||||
bool operator()(const ValueType &a, const ValueType &b) const
|
||||
{ return a == b; }
|
||||
};
|
||||
|
||||
#endif //BOOST_CONTAINER_DETAIL_VALUE_FUNCTORS_HPP
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
template<class T>
|
||||
struct value_init
|
||||
@@ -42,7 +42,7 @@ struct value_init
|
||||
T m_t;
|
||||
};
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
} //namespace container {
|
||||
} //namespace boost {
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
namespace boost {
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
template<typename... Values>
|
||||
class tuple;
|
||||
@@ -78,7 +78,7 @@ class tuple<Head, Tail...>
|
||||
|
||||
|
||||
template<typename... Values>
|
||||
tuple<Values&&...> forward_as_tuple(Values&&... values)
|
||||
tuple<Values&&...> forward_as_tuple_impl(Values&&... values)
|
||||
{ return tuple<Values&&...>(::boost::forward<Values>(values)...); }
|
||||
|
||||
template<int I, typename Tuple>
|
||||
@@ -156,7 +156,7 @@ struct build_number_seq
|
||||
template<> struct build_number_seq<0> : index_tuple<>{};
|
||||
template<> struct build_number_seq<1> : index_tuple<0>{};
|
||||
|
||||
}}} //namespace boost { namespace container { namespace container_detail {
|
||||
}}} //namespace boost { namespace container { namespace dtl {
|
||||
|
||||
#include <boost/container/detail/config_end.hpp>
|
||||
|
||||
|
||||
@@ -32,31 +32,21 @@
|
||||
|
||||
namespace boost{
|
||||
namespace container {
|
||||
namespace container_detail {
|
||||
namespace dtl {
|
||||
|
||||
template <class T, unsigned V>
|
||||
struct version_type
|
||||
: public container_detail::integral_constant<unsigned, V>
|
||||
: public dtl::integral_constant<unsigned, V>
|
||||
{
|
||||
typedef T type;
|
||||
|
||||
version_type(const version_type<T, 0>&);
|
||||
};
|
||||
|
||||
namespace impl{
|
||||
|
||||
template <class T,
|
||||
bool = container_detail::is_convertible<version_type<T, 0>, typename T::version>::value>
|
||||
struct extract_version
|
||||
{
|
||||
static const unsigned value = 1;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct extract_version<T, true>
|
||||
{
|
||||
static const unsigned value = T::version::value;
|
||||
};
|
||||
struct extract_version
|
||||
: T::version
|
||||
{};
|
||||
|
||||
template <class T>
|
||||
struct has_version
|
||||
@@ -86,7 +76,7 @@ struct version<T, true>
|
||||
|
||||
template <class T>
|
||||
struct version
|
||||
: public container_detail::integral_constant<unsigned, impl::version<T>::value>
|
||||
: public dtl::integral_constant<unsigned, impl::version<T>::value>
|
||||
{};
|
||||
|
||||
template<class T, unsigned N>
|
||||
@@ -96,11 +86,11 @@ struct is_version
|
||||
is_same< typename version<T>::type, integral_constant<unsigned, N> >::value;
|
||||
};
|
||||
|
||||
} //namespace container_detail {
|
||||
} //namespace dtl {
|
||||
|
||||
typedef container_detail::integral_constant<unsigned, 0> version_0;
|
||||
typedef container_detail::integral_constant<unsigned, 1> version_1;
|
||||
typedef container_detail::integral_constant<unsigned, 2> version_2;
|
||||
typedef dtl::integral_constant<unsigned, 0> version_0;
|
||||
typedef dtl::integral_constant<unsigned, 1> version_1;
|
||||
typedef dtl::integral_constant<unsigned, 2> version_2;
|
||||
|
||||
} //namespace container {
|
||||
} //namespace boost{
|
||||
|
||||
@@ -43,12 +43,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_FALLTHOUGH)
|
||||
#define BOOST_CONTAINER_FALLTHOUGH
|
||||
#else
|
||||
#define BOOST_CONTAINER_FALLTHOUGH BOOST_FALLTHOUGH;
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_MSVC) && (_MSC_VER < 1400)
|
||||
#define BOOST_CONTAINER_TEMPLATED_CONVERSION_OPERATOR_BROKEN
|
||||
#endif
|
||||
@@ -114,4 +108,26 @@
|
||||
#define BOOST_CONTAINER_FORCEINLINE BOOST_FORCEINLINE
|
||||
#endif
|
||||
|
||||
#if !defined(__has_feature)
|
||||
#define BOOST_CONTAINER_HAS_FEATURE(feature) 0
|
||||
#else
|
||||
#define BOOST_CONTAINER_HAS_FEATURE(feature) __has_feature(feature)
|
||||
#endif
|
||||
|
||||
//Detect address sanitizer
|
||||
#if defined(__SANITIZE_ADDRESS__) || BOOST_CONTAINER_HAS_FEATURE(address_sanitizer)
|
||||
#define BOOST_CONTAINER_ASAN
|
||||
#endif
|
||||
|
||||
|
||||
#if (__cplusplus >= 201703L)
|
||||
//CTAD supported
|
||||
#ifdef __INTEL_COMPILER
|
||||
//Intel compilers do not offer this feature yet
|
||||
#define BOOST_CONTAINER_NO_CXX17_CTAD
|
||||
#endif
|
||||
#else
|
||||
#define BOOST_CONTAINER_NO_CXX17_CTAD
|
||||
#endif
|
||||
|
||||
#endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP
|
||||
|
||||
Reference in New Issue
Block a user