view release on metacpan or search on metacpan
include/boost/config/detail/suffix.hpp view on Meta::CPAN
# elif defined(_MSC_VER)
# define BOOST_ALIGNMENT(x) __declspec(align(x))
# elif defined(__GNUC__)
# define BOOST_ALIGNMENT(x) __attribute__ ((__aligned__(x)))
# else
# define BOOST_NO_ALIGNMENT
# define BOOST_ALIGNMENT(x)
# endif
#endif
// Lack of non-public defaulted functions is implied by the lack of any defaulted functions
#if !defined(BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS) && defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)
# define BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS
#endif
// Lack of defaulted moves is implied by the lack of either rvalue references or any defaulted functions
#if !defined(BOOST_NO_CXX11_DEFAULTED_MOVES) && (defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || defined(BOOST_NO_CXX11_RVALUE_REFERENCES))
# define BOOST_NO_CXX11_DEFAULTED_MOVES
#endif
// Defaulted and deleted function declaration helpers
// These macros are intended to be inside a class definition.
// BOOST_DEFAULTED_FUNCTION accepts the function declaration and its
// body, which will be used if the compiler doesn't support defaulted functions.
// BOOST_DELETED_FUNCTION only accepts the function declaration. It
// will expand to a private function declaration, if the compiler doesn't support
// deleted functions. Because of this it is recommended to use BOOST_DELETED_FUNCTION
// in the end of the class definition.
//
// class my_class
// {
// public:
// // Default-constructible
// BOOST_DEFAULTED_FUNCTION(my_class(), {})
// // Copying prohibited
// BOOST_DELETED_FUNCTION(my_class(my_class const&))
// BOOST_DELETED_FUNCTION(my_class& operator= (my_class const&))
// };
//
#if !(defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || defined(BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS))
# define BOOST_DEFAULTED_FUNCTION(fun, body) fun = default;
#else
include/boost/container/adaptive_pool.hpp view on Meta::CPAN
template < class T
, std::size_t NodesPerBlock BOOST_CONTAINER_DOCONLY(= ADP_nodes_per_block)
, std::size_t MaxFreeBlocks BOOST_CONTAINER_DOCONLY(= ADP_max_free_blocks)
, std::size_t OverheadPercent BOOST_CONTAINER_DOCONLY(= ADP_overhead_percent)
BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I unsigned Version)
>
class adaptive_pool
{
//!If Version is 1, the allocator is a STL conforming allocator. If Version is 2,
//!the allocator offers advanced expand in place and burst allocation capabilities.
public:
typedef unsigned int allocation_type;
typedef adaptive_pool
<T, NodesPerBlock, MaxFreeBlocks, OverheadPercent
BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I Version)
> self_t;
static const std::size_t nodes_per_block = NodesPerBlock;
static const std::size_t max_free_blocks = MaxFreeBlocks;
static const std::size_t overhead_percent = OverheadPercent;
static const std::size_t real_nodes_per_block = NodesPerBlock;
BOOST_CONTAINER_DOCIGN(BOOST_STATIC_ASSERT((Version <=2)));
public:
//-------
typedef T value_type;
typedef T * pointer;
typedef const T * const_pointer;
typedef typename ::boost::container::
dtl::unvoid_ref<T>::type reference;
typedef typename ::boost::container::
dtl::unvoid_ref<const T>::type const_reference;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
include/boost/container/adaptive_pool.hpp view on Meta::CPAN
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
//!Not assignable from related adaptive_pool
template<class T2, std::size_t N2, std::size_t F2, std::size_t O2, unsigned Version2>
adaptive_pool& operator=
(const adaptive_pool<T2, N2, F2, O2, Version2>&);
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
//!Default constructor
adaptive_pool() BOOST_NOEXCEPT_OR_NOTHROW
{}
//!Copy constructor from other adaptive_pool.
adaptive_pool(const adaptive_pool &) BOOST_NOEXCEPT_OR_NOTHROW
{}
//!Copy constructor from related adaptive_pool.
template<class T2>
include/boost/container/adaptive_pool.hpp view on Meta::CPAN
template < class T
, std::size_t NodesPerBlock = ADP_nodes_per_block
, std::size_t MaxFreeBlocks = ADP_max_free_blocks
, std::size_t OverheadPercent = ADP_overhead_percent
, unsigned Version = 2
>
class private_adaptive_pool
{
//!If Version is 1, the allocator is a STL conforming allocator. If Version is 2,
//!the allocator offers advanced expand in place and burst allocation capabilities.
public:
typedef unsigned int allocation_type;
typedef private_adaptive_pool
<T, NodesPerBlock, MaxFreeBlocks, OverheadPercent
BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I Version)
> self_t;
static const std::size_t nodes_per_block = NodesPerBlock;
static const std::size_t max_free_blocks = MaxFreeBlocks;
static const std::size_t overhead_percent = OverheadPercent;
static const std::size_t real_nodes_per_block = NodesPerBlock;
BOOST_CONTAINER_DOCIGN(BOOST_STATIC_ASSERT((Version <=2)));
typedef dtl::private_adaptive_node_pool
<sizeof(T), NodesPerBlock, MaxFreeBlocks, OverheadPercent> pool_t;
pool_t m_pool;
public:
//-------
typedef T value_type;
typedef T * pointer;
typedef const T * const_pointer;
typedef typename ::boost::container::
dtl::unvoid_ref<T>::type reference;
typedef typename ::boost::container::
dtl::unvoid_ref<const T>::type const_reference;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
include/boost/container/adaptive_pool.hpp view on Meta::CPAN
};
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
//!Not assignable from related private_adaptive_pool
template<class T2, std::size_t N2, std::size_t F2, std::size_t O2, unsigned Version2>
private_adaptive_pool& operator=
(const private_adaptive_pool<T2, N2, F2, O2, Version2>&);
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
//!Default constructor
private_adaptive_pool() BOOST_NOEXCEPT_OR_NOTHROW
{}
//!Copy constructor from other private_adaptive_pool.
private_adaptive_pool(const private_adaptive_pool &) BOOST_NOEXCEPT_OR_NOTHROW
{}
//!Copy constructor from related private_adaptive_pool.
template<class T2>
include/boost/container/allocator.hpp view on Meta::CPAN
namespace boost {
namespace container {
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template<unsigned Version, unsigned int AllocationDisableMask>
class allocator<void, Version, AllocationDisableMask>
{
typedef allocator<void, Version, AllocationDisableMask> self_t;
public:
typedef void value_type;
typedef void * pointer;
typedef const void* const_pointer;
typedef int & reference;
typedef const int & const_reference;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef boost::container::dtl::
version_type<self_t, Version> version;
include/boost/container/allocator.hpp view on Meta::CPAN
BOOST_CONTAINER_ALLOCATE_NEW | BOOST_CONTAINER_EXPAND_BWD | BOOST_CONTAINER_EXPAND_FWD ;
//The mask can't disable all the allocation types
BOOST_STATIC_ASSERT(( (AllocationDisableMask & ForbiddenMask) != ForbiddenMask ));
//The mask is only valid for version 2 allocators
BOOST_STATIC_ASSERT(( Version != 1 || (AllocationDisableMask == 0) ));
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
typedef T value_type;
typedef T * pointer;
typedef const T * const_pointer;
typedef T & reference;
typedef const T & const_reference;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef boost::container::dtl::
version_type<self_t, Version> version;
include/boost/container/allocator_traits.hpp view on Meta::CPAN
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class T, class ...Args>
BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::true_type, Allocator &a, T *p, BOOST_FWD_REF(Args) ...args)
{ a.construct( p, ::boost::forward<Args>(args)...); }
template<class T, class ...Args>
BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::false_type, Allocator &, T *p, BOOST_FWD_REF(Args) ...args)
{ ::new((void*)p, boost_container_new_t()) T(::boost::forward<Args>(args)...); }
#else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
public:
#define BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL(N) \
template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\
BOOST_CONTAINER_FORCEINLINE static void construct(Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
{\
static const bool value = ::boost::move_detail::and_ \
< dtl::is_not_std_allocator<Allocator> \
, boost::container::dtl::has_member_function_callable_with_construct \
< Allocator, T* BOOST_MOVE_I##N BOOST_MOVE_FWD_T##N > \
>::value; \
include/boost/container/container_fwd.hpp view on Meta::CPAN
struct ordered_range_t
{};
//! Value used to tag that the input range is
//! guaranteed to be ordered
static const ordered_range_t ordered_range = ordered_range_t();
//! Type used to tag that the input range is
//! guaranteed to be ordered and unique
struct ordered_unique_range_t
: public ordered_range_t
{};
//! Value used to tag that the input range is
//! guaranteed to be ordered and unique
static const ordered_unique_range_t ordered_unique_range = ordered_unique_range_t();
//! Type used to tag that the inserted values
//! should be default initialized
struct default_init_t
{};
include/boost/container/deque.hpp view on Meta::CPAN
// objects, and [start.first, start.cur) and [finish.cur, finish.last)
// are uninitialized storage.
// [map, map + map_size) is a valid, non-empty range.
// [start.node, finish.node] is a valid range contained within
// [map, map + map_size).
// A pointer in the range [map, map + map_size) points to an allocated node
// if and only if the pointer is in the range [start.node, finish.node].
template<class Pointer, bool IsConst>
class deque_iterator
{
public:
typedef std::random_access_iterator_tag iterator_category;
typedef typename boost::intrusive::pointer_traits<Pointer>::element_type value_type;
typedef typename boost::intrusive::pointer_traits<Pointer>::difference_type difference_type;
typedef typename if_c
< IsConst
, typename boost::intrusive::pointer_traits<Pointer>::template
rebind_pointer<const value_type>::type
, Pointer
>::type pointer;
typedef typename if_c
include/boost/container/deque.hpp view on Meta::CPAN
typedef Pointer val_alloc_ptr;
typedef typename boost::intrusive::pointer_traits<Pointer>::
template rebind_pointer<Pointer>::type index_pointer;
Pointer m_cur;
Pointer m_first;
Pointer m_last;
index_pointer m_node;
public:
Pointer get_cur() const { return m_cur; }
Pointer get_first() const { return m_first; }
Pointer get_last() const { return m_last; }
index_pointer get_node() const { return m_node; }
deque_iterator(val_alloc_ptr x, index_pointer y) BOOST_NOEXCEPT_OR_NOTHROW
: m_cur(x), m_first(*y), m_last(*y + s_buffer_size()), m_node(y)
{}
include/boost/container/deque.hpp view on Meta::CPAN
} //namespace dtl {
// Deque base class. It has two purposes. First, its constructor
// and destructor allocate (but don't initialize) storage. This makes
// exception safety easier.
template <class Allocator>
class deque_base
{
BOOST_COPYABLE_AND_MOVABLE(deque_base)
public:
typedef allocator_traits<Allocator> val_alloc_traits_type;
typedef typename val_alloc_traits_type::value_type val_alloc_val;
typedef typename val_alloc_traits_type::pointer val_alloc_ptr;
typedef typename val_alloc_traits_type::const_pointer val_alloc_cptr;
typedef typename val_alloc_traits_type::reference val_alloc_ref;
typedef typename val_alloc_traits_type::const_reference val_alloc_cref;
typedef typename val_alloc_traits_type::difference_type val_alloc_diff;
typedef typename val_alloc_traits_type::size_type val_alloc_size;
typedef typename val_alloc_traits_type::template
portable_rebind_alloc<val_alloc_ptr>::type ptr_alloc_t;
include/boost/container/deque.hpp view on Meta::CPAN
this->members_.m_map_size = 0;
this->members_.m_start = iterator();
this->members_.m_finish = this->members_.m_start;
}
}
enum { InitialMapSize = 8 };
protected:
struct members_holder
: public ptr_alloc_t
, public allocator_type
{
members_holder()
: map_allocator_type(), allocator_type()
, m_map(0), m_map_size(0)
, m_start(), m_finish(m_start)
{}
explicit members_holder(const allocator_type &a)
: map_allocator_type(a), allocator_type(a)
, m_map(0), m_map_size(0)
include/boost/container/deque.hpp view on Meta::CPAN
#else
template <class T, class Allocator>
#endif
class deque : protected deque_base<Allocator>
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
typedef deque_base<Allocator> Base;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
//////////////////////////////////////////////
//
// types
//
//////////////////////////////////////////////
typedef T value_type;
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
include/boost/container/deque.hpp view on Meta::CPAN
private: // Internal typedefs
BOOST_COPYABLE_AND_MOVABLE(deque)
typedef typename Base::ptr_alloc_ptr index_pointer;
static size_type s_buffer_size()
{ return Base::s_buffer_size(); }
typedef allocator_traits<Allocator> allocator_traits_type;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
//////////////////////////////////////////////
//
// construct/copy/destroy
//
//////////////////////////////////////////////
//! <b>Effects</b>: Default constructors a deque.
//!
//! <b>Throws</b>: If allocator_type's default constructor throws.
//!
include/boost/container/detail/adaptive_node_pool.hpp view on Meta::CPAN
//!Pooled memory allocator using an smart adaptive pool. Includes
//!a reference count but the class does not delete itself, this is
//!responsibility of user classes. Node size (NodeSize) and the number of
//!nodes allocated per block (NodesPerBlock) are known at compile time.
template< std::size_t NodeSize
, std::size_t NodesPerBlock
, std::size_t MaxFreeBlocks
, std::size_t OverheadPercent
>
class private_adaptive_node_pool
: 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
>
{
include/boost/container/detail/adaptive_node_pool.hpp view on Meta::CPAN
, 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:
static const std::size_t nodes_per_block = NodesPerBlock;
//!Constructor. Never throws
private_adaptive_node_pool()
: base_t(0)
{}
};
//!Pooled memory allocator using adaptive pool. Includes
//!a reference count but the class does not delete itself, this is
//!responsibility of user classes. Node size (NodeSize) and the number of
//!nodes allocated per block (NodesPerBlock) are known at compile time
template< std::size_t NodeSize
, std::size_t NodesPerBlock
, std::size_t MaxFreeBlocks
, std::size_t OverheadPercent
>
class shared_adaptive_node_pool
: public private_adaptive_node_pool
<NodeSize, NodesPerBlock, MaxFreeBlocks, OverheadPercent>
{
private:
typedef private_adaptive_node_pool
<NodeSize, NodesPerBlock, MaxFreeBlocks, OverheadPercent> private_node_allocator_t;
public:
typedef typename private_node_allocator_t::multiallocation_chain multiallocation_chain;
//!Constructor. Never throws
shared_adaptive_node_pool()
: private_node_allocator_t(){}
//!Destructor. Deallocates all allocated blocks. Never throws
~shared_adaptive_node_pool()
{}
include/boost/container/detail/adaptive_node_pool_impl.hpp view on Meta::CPAN
{
typedef VoidPointer void_pointer;
static const unsigned ordered = (Flags & (adaptive_pool_flag::size_ordered | adaptive_pool_flag::address_ordered));
typedef block_container_traits<VoidPointer, SizeType, ordered> block_container_traits_t;
typedef typename block_container_traits_t::hook_t hook_t;
typedef hdr_offset_holder_t<SizeType> hdr_offset_holder;
static const unsigned int order_flags = Flags & (adaptive_pool_flag::size_ordered | adaptive_pool_flag::address_ordered);
typedef MultiallocationChain free_nodes_t;
struct block_info_t
: public hdr_offset_holder,
public hook_t
{
//An intrusive list of free node from this block
free_nodes_t free_nodes;
friend bool operator <(const block_info_t &l, const block_info_t &r)
{
return less_func<SizeType, order_flags>::
less(l.free_nodes.size(), r.free_nodes.size(), &l , &r);
}
friend bool operator ==(const block_info_t &l, const block_info_t &r)
include/boost/container/detail/adaptive_node_pool_impl.hpp view on Meta::CPAN
}
/////////////////////////////////////////////
//
// private_adaptive_node_pool_impl_common
//
/////////////////////////////////////////////
template< class SegmentManagerBase, unsigned int Flags>
class private_adaptive_node_pool_impl_common
{
public:
//!Segment manager typedef
typedef SegmentManagerBase segment_manager_base_type;
typedef typename SegmentManagerBase::multiallocation_chain multiallocation_chain;
typedef typename SegmentManagerBase::size_type size_type;
//Flags
//align_only
static const bool AlignOnly = (Flags & adaptive_pool_flag::align_only) != 0;
typedef bool_<AlignOnly> IsAlignOnly;
typedef true_ AlignOnlyTrue;
typedef false_ AlignOnlyFalse;
include/boost/container/detail/adaptive_node_pool_impl.hpp view on Meta::CPAN
segment_mngr_base_ptr_t mp_segment_mngr_base; //Segment manager
block_container_t m_block_container; //Intrusive block list
size_type m_totally_free_blocks; //Free blocks
class block_destroyer;
friend class block_destroyer;
class block_destroyer
{
public:
block_destroyer(const this_type *impl, multiallocation_chain &chain, const size_type num_subblocks, const size_type real_block_alignment, const size_type real_num_node)
: mp_impl(impl), m_chain(chain), m_num_subblocks(num_subblocks), m_real_block_alignment(real_block_alignment), m_real_num_node(real_num_node)
{}
void operator()(typename block_container_t::pointer to_deallocate)
{ return this->do_destroy(to_deallocate, IsAlignOnly()); }
private:
void do_destroy(typename block_container_t::pointer to_deallocate, AlignOnlyTrue)
{
include/boost/container/detail/adaptive_node_pool_impl.hpp view on Meta::CPAN
#endif
//Check for memory leaks
this->priv_invariants(real_num_node, num_subblocks, real_block_alignment);
multiallocation_chain chain;
m_block_container.clear_and_dispose(block_destroyer(this, chain, num_subblocks, real_block_alignment, real_num_node));
this->mp_segment_mngr_base->deallocate_many(chain);
m_totally_free_blocks = 0;
this->priv_invariants(real_num_node, num_subblocks, real_block_alignment);
}
public:
private_adaptive_node_pool_impl_common(segment_manager_base_type *segment_mngr_base)
//General purpose allocator
: mp_segment_mngr_base(segment_mngr_base)
, m_block_container()
, m_totally_free_blocks(0)
{}
size_type num_free_nodes()
{
typedef typename block_container_t::const_iterator citerator;
include/boost/container/detail/adaptive_node_pool_impl.hpp view on Meta::CPAN
// private_adaptive_node_pool_impl_ct
//
/////////////////////////////////////////////
template< class SegmentManagerBase
, std::size_t MaxFreeBlocks
, std::size_t NodeSize
, std::size_t NodesPerBlock
, std::size_t OverheadPercent
, unsigned int Flags>
class private_adaptive_node_pool_impl_ct
: public private_adaptive_node_pool_impl_common<SegmentManagerBase, Flags>
{
typedef private_adaptive_node_pool_impl_common<SegmentManagerBase, Flags> base_t;
//Non-copyable
private_adaptive_node_pool_impl_ct();
private_adaptive_node_pool_impl_ct(const private_adaptive_node_pool_impl_ct &);
private_adaptive_node_pool_impl_ct &operator=(const private_adaptive_node_pool_impl_ct &);
public:
typedef typename base_t::void_pointer void_pointer;
typedef typename base_t::size_type size_type;
typedef typename base_t::multiallocation_chain multiallocation_chain;
typedef typename base_t::segment_manager_base_type segment_manager_base_type;
static const typename base_t::size_type PayloadPerAllocation = base_t::PayloadPerAllocation;
//align_only
static const bool AlignOnly = base_t::AlignOnly;
include/boost/container/detail/adaptive_node_pool_impl.hpp view on Meta::CPAN
< size_type, HdrSize, PayloadPerAllocation
, RealNodeSize, NodesPerBlock, HdrOffsetSize, OverheadPercent, AlignOnly> data_t;
//Round the size to a power of two value.
//This is the total memory size (including payload) that we want to
//allocate from the general-purpose allocator
static const size_type NumSubBlocks = data_t::num_subblocks;
static const size_type RealNumNode = data_t::real_num_node;
static const size_type RealBlockAlignment = data_t::alignment;
public:
//!Constructor from a segment manager. Never throws
private_adaptive_node_pool_impl_ct(typename base_t::segment_manager_base_type *segment_mngr_base)
//General purpose allocator
: base_t(segment_mngr_base)
{}
//!Destructor. Deallocates all allocated blocks. Never throws
~private_adaptive_node_pool_impl_ct()
{ this->priv_clear(NumSubBlocks, data_t::alignment, RealNumNode); }
include/boost/container/detail/adaptive_node_pool_impl.hpp view on Meta::CPAN
size_type m_real_block_alignment;
size_type m_num_subblocks;
//This is the real number of nodes per block
size_type m_real_num_node;
};
template<class SegmentManagerBase, unsigned int Flags>
class private_adaptive_node_pool_impl_rt
: private private_adaptive_node_pool_impl_rt_data<typename SegmentManagerBase::size_type>
, public private_adaptive_node_pool_impl_common<SegmentManagerBase, Flags>
{
typedef private_adaptive_node_pool_impl_common<SegmentManagerBase, Flags> impl_t;
typedef private_adaptive_node_pool_impl_rt_data<typename SegmentManagerBase::size_type> data_t;
//Non-copyable
private_adaptive_node_pool_impl_rt();
private_adaptive_node_pool_impl_rt(const private_adaptive_node_pool_impl_rt &);
private_adaptive_node_pool_impl_rt &operator=(const private_adaptive_node_pool_impl_rt &);
protected:
include/boost/container/detail/adaptive_node_pool_impl.hpp view on Meta::CPAN
static const typename impl_t::size_type PayloadPerAllocation = impl_t::PayloadPerAllocation;
//Flags
//align_only
static const bool AlignOnly = impl_t::AlignOnly;
static const size_type HdrSize = impl_t::HdrSize;
static const size_type HdrOffsetSize = impl_t::HdrOffsetSize;
public:
//!Segment manager typedef
typedef SegmentManagerBase segment_manager_base_type;
//!Constructor from a segment manager. Never throws
private_adaptive_node_pool_impl_rt
( segment_manager_base_type *segment_mngr_base
, size_type node_size
, size_type nodes_per_block
, size_type max_free_blocks
include/boost/container/detail/advanced_insert_int.hpp view on Meta::CPAN
BOOST_ASSERT(n == 1); (void)n;
alloc_traits::construct( a, boost::movelib::iterator_to_raw_pointer(p), ::boost::forward<Args>(get<IdxPack>(this->args_))... );
}
protected:
tuple<Args&...> args_;
};
template<class Allocator, class Iterator, class ...Args>
struct insert_emplace_proxy
: public insert_nonmovable_emplace_proxy<Allocator, Iterator, Args...>
{
typedef insert_nonmovable_emplace_proxy<Allocator, Iterator, Args...> base_t;
typedef boost::container::allocator_traits<Allocator> alloc_traits;
typedef typename base_t::value_type value_type;
typedef typename base_t::size_type size_type;
typedef typename base_t::index_tuple_t index_tuple_t;
explicit insert_emplace_proxy(BOOST_FWD_REF(Args)... args)
: base_t(::boost::forward<Args>(args)...)
{}
include/boost/container/detail/advanced_insert_int.hpp view on Meta::CPAN
BOOST_RETHROW
}
BOOST_CATCH_END
alloc_traits::destroy(a, vp);
}
};
//Specializations to avoid an unneeded temporary when emplacing from a single argument o type value_type
template<class Allocator, class Iterator>
struct insert_emplace_proxy<Allocator, Iterator, typename boost::container::allocator_traits<Allocator>::value_type>
: public insert_move_proxy<Allocator, Iterator>
{
explicit insert_emplace_proxy(typename boost::container::allocator_traits<Allocator>::value_type &&v)
: insert_move_proxy<Allocator, Iterator>(v)
{}
};
//We use "add_const" here as adding "const" only confuses MSVC12(and maybe later) provoking
//compiler error C2752 ("more than one partial specialization matches").
//Any problem is solvable with an extra layer of indirection? ;-)
template<class Allocator, class Iterator>
struct insert_emplace_proxy<Allocator, Iterator
, typename boost::container::dtl::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type
>
: public insert_copy_proxy<Allocator, Iterator>
{
explicit insert_emplace_proxy(const typename boost::container::allocator_traits<Allocator>::value_type &v)
: insert_copy_proxy<Allocator, Iterator>(v)
{}
};
template<class Allocator, class Iterator>
struct insert_emplace_proxy<Allocator, Iterator, typename boost::container::allocator_traits<Allocator>::value_type &>
: public insert_copy_proxy<Allocator, Iterator>
{
explicit insert_emplace_proxy(const typename boost::container::allocator_traits<Allocator>::value_type &v)
: insert_copy_proxy<Allocator, Iterator>(v)
{}
};
template<class Allocator, class Iterator>
struct insert_emplace_proxy<Allocator, Iterator
, typename boost::container::dtl::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type &
>
: public insert_copy_proxy<Allocator, Iterator>
{
explicit insert_emplace_proxy(const typename boost::container::allocator_traits<Allocator>::value_type &v)
: insert_copy_proxy<Allocator, Iterator>(v)
{}
};
}}} //namespace boost { namespace container { namespace dtl {
#else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
include/boost/container/detail/advanced_insert_int.hpp view on Meta::CPAN
};\
//
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_ADVANCED_INSERT_INT_CODE)
#undef BOOST_CONTAINER_ADVANCED_INSERT_INT_CODE
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
//Specializations to avoid an unneeded temporary when emplacing from a single argument o type value_type
template<class Allocator, class Iterator>
struct insert_emplace_proxy_arg1<Allocator, Iterator, ::boost::rv<typename boost::container::allocator_traits<Allocator>::value_type> >
: public insert_move_proxy<Allocator, Iterator>
{
explicit insert_emplace_proxy_arg1(typename boost::container::allocator_traits<Allocator>::value_type &v)
: insert_move_proxy<Allocator, Iterator>(v)
{}
};
template<class Allocator, class Iterator>
struct insert_emplace_proxy_arg1<Allocator, Iterator, typename boost::container::allocator_traits<Allocator>::value_type>
: public insert_copy_proxy<Allocator, Iterator>
{
explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits<Allocator>::value_type &v)
: insert_copy_proxy<Allocator, Iterator>(v)
{}
};
#else //e.g. MSVC10 & MSVC11
//Specializations to avoid an unneeded temporary when emplacing from a single argument o type value_type
template<class Allocator, class Iterator>
struct insert_emplace_proxy_arg1<Allocator, Iterator, typename boost::container::allocator_traits<Allocator>::value_type>
: public insert_move_proxy<Allocator, Iterator>
{
explicit insert_emplace_proxy_arg1(typename boost::container::allocator_traits<Allocator>::value_type &&v)
: insert_move_proxy<Allocator, Iterator>(v)
{}
};
//We use "add_const" here as adding "const" only confuses MSVC10&11 provoking
//compiler error C2752 ("more than one partial specialization matches").
//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::dtl::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type
>
: public insert_copy_proxy<Allocator, Iterator>
{
explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits<Allocator>::value_type &v)
: insert_copy_proxy<Allocator, Iterator>(v)
{}
};
template<class Allocator, class Iterator>
struct insert_emplace_proxy_arg1<Allocator, Iterator, typename boost::container::allocator_traits<Allocator>::value_type &>
: public insert_copy_proxy<Allocator, Iterator>
{
explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits<Allocator>::value_type &v)
: insert_copy_proxy<Allocator, Iterator>(v)
{}
};
template<class Allocator, class Iterator>
struct insert_emplace_proxy_arg1<Allocator, Iterator
, typename boost::container::dtl::add_const<typename boost::container::allocator_traits<Allocator>::value_type>::type &
>
: public insert_copy_proxy<Allocator, Iterator>
{
explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits<Allocator>::value_type &v)
: insert_copy_proxy<Allocator, Iterator>(v)
{}
};
#endif
}}} //namespace boost { namespace container { namespace dtl {
include/boost/container/detail/algorithm.hpp view on Meta::CPAN
namespace boost {
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); }
include/boost/container/detail/algorithm.hpp view on Meta::CPAN
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); }
include/boost/container/detail/algorithm.hpp view on Meta::CPAN
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); }
include/boost/container/detail/block_list.hpp view on Meta::CPAN
{ return n->previous; }
static void set_next(const node_ptr & n, const node_ptr & next)
{ n->next = next; }
static void set_previous(const node_ptr & n, const node_ptr & previous)
{ n->previous = previous; }
};
struct block_list_header
: public list_node
{
std::size_t size;
};
typedef bi::circular_list_algorithms<list_node_traits> list_algo;
template<class DerivedFromBlockListHeader = block_list_header>
class block_list_base
{
list_node m_list;
static const std::size_t MaxAlignMinus1 = memory_resource::max_align-1u;
public:
static const std::size_t header_size = std::size_t(sizeof(DerivedFromBlockListHeader) + MaxAlignMinus1) & std::size_t(~MaxAlignMinus1);
explicit block_list_base()
{ list_algo::init_header(&m_list); }
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
block_list_base(const block_list_base&) = delete;
block_list_base operator=(const block_list_base&) = delete;
#else
private:
block_list_base (const block_list_base&);
block_list_base operator=(const block_list_base&);
public:
#endif
~block_list_base()
{}
void *allocate(std::size_t size, memory_resource &mr)
{
if((size_t(-1) - header_size) < size)
throw_bad_alloc();
void *p = mr.allocate(size+header_size);
include/boost/container/detail/block_slist.hpp view on Meta::CPAN
typedef const slist_node* const_node_ptr;
static node_ptr get_next(const_node_ptr n)
{ return n->next; }
static void set_next(const node_ptr & n, const node_ptr & next)
{ n->next = next; }
};
struct block_slist_header
: public slist_node
{
std::size_t size;
};
typedef bi::linear_slist_algorithms<slist_node_traits> slist_algo;
template<class DerivedFromBlockSlistHeader = block_slist_header>
class block_slist_base
{
slist_node m_slist;
static const std::size_t MaxAlignMinus1 = memory_resource::max_align-1u;
public:
static const std::size_t header_size = std::size_t(sizeof(DerivedFromBlockSlistHeader) + MaxAlignMinus1) & std::size_t(~MaxAlignMinus1);
explicit block_slist_base()
{ slist_algo::init_header(&m_slist); }
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
block_slist_base(const block_slist_base&) = delete;
block_slist_base operator=(const block_slist_base&) = delete;
#else
private:
block_slist_base (const block_slist_base&);
block_slist_base operator=(const block_slist_base&);
public:
#endif
~block_slist_base()
{}
void *allocate(std::size_t size, memory_resource &mr)
{
if((size_t(-1) - header_size) < size)
throw_bad_alloc();
void *p = mr.allocate(size+header_size);
include/boost/container/detail/block_slist.hpp view on Meta::CPAN
n = slist_algo::node_traits::get_next(n);
std::size_t size = d.block_slist_header::size;
d.~DerivedFromBlockSlistHeader();
mr.deallocate(reinterpret_cast<char*>(&d), size, memory_resource::max_align);
}
slist_algo::init_header(&m_slist);
}
};
class block_slist
: public block_slist_base<>
{
memory_resource &m_upstream_rsrc;
public:
explicit block_slist(memory_resource &upstream_rsrc)
: block_slist_base<>(), m_upstream_rsrc(upstream_rsrc)
{}
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
block_slist(const block_slist&) = delete;
block_slist operator=(const block_slist&) = delete;
#else
private:
block_slist (const block_slist&);
block_slist operator=(const block_slist&);
public:
#endif
~block_slist()
{ this->release(); }
void *allocate(std::size_t size)
{ return this->block_slist_base<>::allocate(size, m_upstream_rsrc); }
void release() BOOST_NOEXCEPT
{ return this->block_slist_base<>::release(m_upstream_rsrc); }
include/boost/container/detail/compare_functors.hpp view on Meta::CPAN
namespace boost {
namespace container {
template<class Allocator>
class equal_to_value
{
typedef typename Allocator::value_type value_type;
const value_type &t_;
public:
explicit equal_to_value(const value_type &t)
: t_(t)
{}
bool operator()(const value_type &t)const
{ return t_ == t; }
};
template<class Node, class Pred>
struct value_to_node_compare
include/boost/container/detail/destroyers.hpp view on Meta::CPAN
private:
void priv_deallocate(version_1)
{ m_alloc.deallocate(m_ptr, 1); }
void priv_deallocate(version_2)
{ m_alloc.deallocate_one(m_ptr); }
BOOST_MOVABLE_BUT_NOT_COPYABLE(scoped_deallocator)
public:
pointer m_ptr;
Allocator& m_alloc;
scoped_deallocator(pointer p, Allocator& a)
: m_ptr(p), m_alloc(a)
{}
~scoped_deallocator()
{ if (m_ptr)priv_deallocate(alloc_version()); }
include/boost/container/detail/destroyers.hpp view on Meta::CPAN
{}
void release()
{}
};
template<class Allocator>
class scoped_destructor
{
typedef boost::container::allocator_traits<Allocator> AllocTraits;
public:
typedef typename Allocator::value_type value_type;
scoped_destructor(Allocator &a, value_type *pv)
: pv_(pv), a_(a)
{}
~scoped_destructor()
{
if(pv_){
AllocTraits::destroy(a_, pv_);
}
include/boost/container/detail/destroyers.hpp view on Meta::CPAN
private:
value_type *pv_;
Allocator &a_;
};
template<class Allocator, class Value = typename Allocator::value_type>
class value_destructor
{
typedef boost::container::allocator_traits<Allocator> AllocTraits;
public:
typedef Value value_type;
value_destructor(Allocator &a, value_type &rv)
: rv_(rv), a_(a)
{}
~value_destructor()
{
AllocTraits::destroy(a_, &rv_);
}
include/boost/container/detail/destroyers.hpp view on Meta::CPAN
private:
Allocator & a_;
private:
void priv_deallocate(const pointer &p, version_1)
{ AllocTraits::deallocate(a_,p, 1); }
void priv_deallocate(const pointer &p, version_2)
{ a_.deallocate_one(p); }
public:
explicit allocator_destroyer(Allocator &a)
: a_(a)
{}
void operator()(const pointer &p)
{
AllocTraits::destroy(a_, boost::movelib::to_raw_pointer(p));
this->priv_deallocate(p, alloc_version());
}
};
include/boost/container/detail/destroyers.hpp view on Meta::CPAN
template <class Allocator>
class allocator_destroyer_and_chain_builder
{
typedef allocator_traits<Allocator> allocator_traits_type;
typedef typename allocator_traits_type::value_type value_type;
typedef typename Allocator::multiallocation_chain multiallocation_chain;
Allocator & a_;
multiallocation_chain &c_;
public:
allocator_destroyer_and_chain_builder(Allocator &a, multiallocation_chain &c)
: a_(a), c_(c)
{}
void operator()(const typename Allocator::pointer &p)
{
allocator_traits<Allocator>::destroy(a_, boost::movelib::to_raw_pointer(p));
c_.push_back(p);
}
};
include/boost/container/detail/destroyers.hpp view on Meta::CPAN
class allocator_multialloc_chain_node_deallocator
{
typedef allocator_traits<Allocator> allocator_traits_type;
typedef typename allocator_traits_type::value_type value_type;
typedef typename Allocator::multiallocation_chain multiallocation_chain;
typedef allocator_destroyer_and_chain_builder<Allocator> chain_builder;
Allocator & a_;
multiallocation_chain c_;
public:
allocator_multialloc_chain_node_deallocator(Allocator &a)
: a_(a), c_()
{}
chain_builder get_chain_builder()
{ return chain_builder(a_, c_); }
~allocator_multialloc_chain_node_deallocator()
{
a_.deallocate_individual(c_);
include/boost/container/detail/flat_tree.hpp view on Meta::CPAN
//
///////////////////////////////////////
template<class Compare, class Value, class KeyOfValue>
class flat_tree_value_compare
: private Compare
{
typedef Value first_argument_type;
typedef Value second_argument_type;
typedef bool return_type;
public:
flat_tree_value_compare()
: Compare()
{}
flat_tree_value_compare(const Compare &pred)
: Compare(pred)
{}
bool operator()(const Value& lhs, const Value& rhs) const
{
include/boost/container/detail/flat_tree.hpp view on Meta::CPAN
///////////////////////////////////////
//
// flat_tree
//
///////////////////////////////////////
template <class Value, class KeyOfValue,
class Compare, class AllocatorOrContainer>
class flat_tree
{
public:
typedef typename select_container_type<Value, AllocatorOrContainer>::type container_type;
typedef container_type sequence_type; //For backwards compatibility
private:
typedef typename container_type::allocator_type allocator_t;
typedef allocator_traits<allocator_t> allocator_traits_type;
public:
typedef flat_tree_value_compare<Compare, Value, KeyOfValue> value_compare;
private:
struct Data
//Inherit from value_compare to do EBO
: public value_compare
{
BOOST_COPYABLE_AND_MOVABLE(Data)
public:
Data()
: value_compare(), m_seq()
{}
explicit Data(const allocator_t &alloc)
: value_compare(), m_seq(alloc)
{}
explicit Data(const Compare &comp)
: value_compare(comp), m_seq()
include/boost/container/detail/flat_tree.hpp view on Meta::CPAN
boost::adl_move_swap(mycomp, othercomp);
this->m_seq.swap(d.m_seq);
}
container_type m_seq;
};
Data m_data;
BOOST_COPYABLE_AND_MOVABLE(flat_tree)
public:
typedef typename container_type::value_type value_type;
typedef typename container_type::pointer pointer;
typedef typename container_type::const_pointer const_pointer;
typedef typename container_type::reference reference;
typedef typename container_type::const_reference const_reference;
typedef typename KeyOfValue::type key_type;
typedef Compare key_compare;
typedef typename container_type::allocator_type allocator_type;
typedef typename container_type::size_type size_type;
include/boost/container/detail/flat_tree.hpp view on Meta::CPAN
typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT
(boost::container::dtl::, container_type
,stored_allocator_type, allocator_type) stored_allocator_type;
static const bool has_stored_allocator_type =
BOOST_INTRUSIVE_HAS_TYPE(boost::container::dtl::, container_type, stored_allocator_type);
private:
typedef allocator_traits<stored_allocator_type> stored_allocator_traits;
public:
typedef typename dtl::if_c
<has_stored_allocator_type, const stored_allocator_type &, allocator_type>::type get_stored_allocator_const_return_t;
typedef typename dtl::if_c
<has_stored_allocator_type, stored_allocator_type &, allocator_type>::type get_stored_allocator_noconst_return_t;
BOOST_CONTAINER_FORCEINLINE flat_tree()
: m_data()
{ }
include/boost/container/detail/flat_tree.hpp view on Meta::CPAN
{ return this->priv_value_comp().get_comp(); }
BOOST_CONTAINER_FORCEINLINE key_compare &priv_key_comp()
{ return this->priv_value_comp().get_comp(); }
struct insert_commit_data
{
const_iterator position;
};
public:
// accessors:
BOOST_CONTAINER_FORCEINLINE Compare key_comp() const
{ return this->m_data.get_comp(); }
BOOST_CONTAINER_FORCEINLINE value_compare value_comp() const
{ return this->m_data; }
BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const
{ return this->m_data.m_seq.get_allocator(); }
include/boost/container/detail/flat_tree.hpp view on Meta::CPAN
{ return this->m_data.m_seq.size(); }
BOOST_CONTAINER_FORCEINLINE size_type max_size() const
{ return this->m_data.m_seq.max_size(); }
BOOST_CONTAINER_FORCEINLINE void swap(flat_tree& other)
BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
&& boost::container::dtl::is_nothrow_swappable<Compare>::value )
{ this->m_data.swap(other.m_data); }
public:
// insert/erase
std::pair<iterator,bool> insert_unique(const value_type& val)
{
std::pair<iterator,bool> ret;
insert_commit_data data;
ret.second = this->priv_insert_unique_prepare(KeyOfValue()(val), data);
ret.first = ret.second ? this->priv_insert_commit(data, val)
: this->begin() + (data.position - this->cbegin());
//: iterator(vector_iterator_get_ptr(data.position));
return ret;
include/boost/container/detail/function_detector.hpp view on Meta::CPAN
static NonStaticFunctionType Test( TestNonStaticNonConst<&U::Identifier>*, int ); \
\
template <class U > \
static NonStaticFunctionType Test( TestNonStaticConst<&U::Identifier>*, int ); \
\
template <class U> \
static StaticFunctionType Test( TestStatic<&U::Identifier>*, int ); \
\
template <class U> \
static NotFoundType Test( ... ); \
public : \
static const int check = NotFound + (sizeof(Test<T>(0, 0)) - sizeof(NotFoundType));\
};\
}}} //namespace boost::container::function_detector {
#define BOOST_CONTAINER_DETECT_FUNCTION(Class, InstantiationKey, ReturnType, Identifier, Params) \
::boost::container::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\
ReturnType (Class::*)Params,\
ReturnType (Class::*)Params const,\
ReturnType (*)Params \
>::check
include/boost/container/detail/iterator.hpp view on Meta::CPAN
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)
{}
include/boost/container/detail/iterators.hpp view on Meta::CPAN
#else
#include <boost/container/detail/variadic_templates_tools.hpp>
#endif
#include <boost/container/detail/iterator.hpp>
namespace boost {
namespace container {
template <class T, class Difference = std::ptrdiff_t>
class constant_iterator
: public ::boost::container::iterator
<std::random_access_iterator_tag, T, Difference, const T*, const T &>
{
typedef constant_iterator<T, Difference> this_type;
public:
explicit constant_iterator(const T &ref, Difference range_size)
: m_ptr(&ref), m_num(range_size){}
//Constructors
constant_iterator()
: m_ptr(0), m_num(0){}
constant_iterator& operator++()
{ increment(); return *this; }
include/boost/container/detail/iterators.hpp view on Meta::CPAN
void advance(Difference n)
{ m_num -= n; }
Difference distance_to(const this_type &other)const
{ return m_num - other.m_num; }
};
template <class T, class Difference>
class value_init_construct_iterator
: public ::boost::container::iterator
<std::random_access_iterator_tag, T, Difference, const T*, const T &>
{
typedef value_init_construct_iterator<T, Difference> this_type;
public:
explicit value_init_construct_iterator(Difference range_size)
: m_num(range_size){}
//Constructors
value_init_construct_iterator()
: m_num(0){}
value_init_construct_iterator& operator++()
{ increment(); return *this; }
include/boost/container/detail/iterators.hpp view on Meta::CPAN
void advance(Difference n)
{ m_num -= n; }
Difference distance_to(const this_type &other)const
{ return m_num - other.m_num; }
};
template <class T, class Difference>
class default_init_construct_iterator
: public ::boost::container::iterator
<std::random_access_iterator_tag, T, Difference, const T*, const T &>
{
typedef default_init_construct_iterator<T, Difference> this_type;
public:
explicit default_init_construct_iterator(Difference range_size)
: m_num(range_size){}
//Constructors
default_init_construct_iterator()
: m_num(0){}
default_init_construct_iterator& operator++()
{ increment(); return *this; }
include/boost/container/detail/iterators.hpp view on Meta::CPAN
void advance(Difference n)
{ m_num -= n; }
Difference distance_to(const this_type &other)const
{ return m_num - other.m_num; }
};
template <class T, class Difference = std::ptrdiff_t>
class repeat_iterator
: public ::boost::container::iterator
<std::random_access_iterator_tag, T, Difference, T*, T&>
{
typedef repeat_iterator<T, Difference> this_type;
public:
explicit repeat_iterator(T &ref, Difference range_size)
: m_ptr(&ref), m_num(range_size){}
//Constructors
repeat_iterator()
: m_ptr(0), m_num(0){}
this_type& operator++()
{ increment(); return *this; }
include/boost/container/detail/iterators.hpp view on Meta::CPAN
void advance(Difference n)
{ m_num -= n; }
Difference distance_to(const this_type &other)const
{ return m_num - other.m_num; }
};
template <class T, class EmplaceFunctor, class Difference /*= std::ptrdiff_t*/>
class emplace_iterator
: public ::boost::container::iterator
<std::random_access_iterator_tag, T, Difference, const T*, const T &>
{
typedef emplace_iterator this_type;
public:
typedef Difference difference_type;
BOOST_CONTAINER_FORCEINLINE explicit emplace_iterator(EmplaceFunctor&e)
: m_num(1), m_pe(&e){}
BOOST_CONTAINER_FORCEINLINE emplace_iterator()
: m_num(0), m_pe(0){}
BOOST_CONTAINER_FORCEINLINE this_type& operator++()
{ increment(); return *this; }
include/boost/container/detail/iterators.hpp view on Meta::CPAN
{ return *this + (-off); }
private:
//This pseudo-iterator's dereference operations have no sense since value is not
//constructed until ::boost::container::construct_in_place is called.
//So comment them to catch bad uses
const T& operator*() const;
const T& operator[](difference_type) const;
const T* operator->() const;
public:
template<class Allocator>
void construct_in_place(Allocator &a, T* ptr)
{ (*m_pe)(a, ptr); }
template<class DestIt>
void assign_in_place(DestIt dest)
{ (*m_pe)(dest); }
private:
difference_type m_num;
include/boost/container/detail/iterators.hpp view on Meta::CPAN
, typename iiterator_types<IIterator>::difference_type
, typename iiterator_types<IIterator>::pointer
, typename iiterator_types<IIterator>::reference> type;
};
template<class IIterator, bool IsConst>
class iterator_from_iiterator
{
typedef typename iterator_types<IIterator, IsConst>::type types_t;
public:
typedef typename types_t::pointer pointer;
typedef typename types_t::reference reference;
typedef typename types_t::difference_type difference_type;
typedef typename types_t::iterator_category iterator_category;
typedef typename types_t::value_type value_type;
BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator()
: m_iit()
{}
include/boost/container/detail/multiallocation_chain.hpp view on Meta::CPAN
{ 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); }
static node_ptr to_node_ptr(const VoidPointer &p)
{ return node_ptr_traits::static_cast_from(p); }
BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_multiallocation_chain)
public:
typedef VoidPointer void_pointer;
typedef typename slist_impl_t::iterator iterator;
typedef typename slist_impl_t::size_type size_type;
basic_multiallocation_chain()
: slist_impl_()
{}
basic_multiallocation_chain(const void_pointer &b, const void_pointer &before_e, size_type n)
include/boost/container/detail/multiallocation_chain.hpp view on Meta::CPAN
struct cast_functor
{
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)); }
};
template<class MultiallocationChain, class T>
class transform_multiallocation_chain
: public MultiallocationChain
{
private:
BOOST_MOVABLE_BUT_NOT_COPYABLE(transform_multiallocation_chain)
//transform_multiallocation_chain(const transform_multiallocation_chain &);
//transform_multiallocation_chain & operator=(const transform_multiallocation_chain &);
typedef typename MultiallocationChain::void_pointer void_pointer;
typedef typename boost::intrusive::pointer_traits
<void_pointer> void_pointer_traits;
typedef typename void_pointer_traits::template
rebind_pointer<T>::type pointer;
typedef typename boost::intrusive::pointer_traits
<pointer> pointer_traits;
static pointer cast(const void_pointer &p)
{ return pointer_traits::static_cast_from(p); }
public:
typedef transform_iterator
< typename MultiallocationChain::iterator
, dtl::cast_functor <T> > iterator;
typedef typename MultiallocationChain::size_type size_type;
transform_multiallocation_chain()
: MultiallocationChain()
{}
transform_multiallocation_chain(BOOST_RV_REF(transform_multiallocation_chain) other)
include/boost/container/detail/mutex.hpp view on Meta::CPAN
namespace container {
namespace dtl {
#if BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_NONE
class null_mutex
{
private:
null_mutex(const null_mutex &);
void operator=(const null_mutex &);
public:
null_mutex() { }
static void lock() { }
static void unlock() { }
};
typedef null_mutex default_mutex;
#elif BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_SPINLOCKS
class spin_mutex
{
private:
BOOST_CONTAINER_MLOCK_T sl;
spin_mutex(const spin_mutex &);
void operator=(const spin_mutex &);
public:
spin_mutex() { BOOST_MOVE_INITIAL_LOCK(&sl); }
void lock() { BOOST_CONTAINER_ACQUIRE_LOCK(&sl); }
void unlock() { BOOST_CONTAINER_RELEASE_LOCK(&sl); }
};
typedef spin_mutex default_mutex;
#elif BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_WIN32
class mutex
{
private:
CRITICAL_SECTION mtx;
mutex(const mutex &);
void operator=(const mutex &);
public:
mutex()
{ InitializeCriticalSection(&mtx); }
~mutex()
{ DeleteCriticalSection(&mtx); }
void lock()
{ EnterCriticalSection(&mtx); }
void unlock()
include/boost/container/detail/mutex.hpp view on Meta::CPAN
typedef mutex default_mutex;
#elif BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_PTHREAD
class mutex
{
private:
pthread_mutex_t mtx;
mutex(const mutex &);
void operator=(const mutex &);
public:
mutex()
{ pthread_mutex_init(&mtx, 0); }
~mutex()
{ pthread_mutex_destroy(&mtx); }
void lock()
{ pthread_mutex_lock(&mtx); }
void unlock()
{ pthread_mutex_unlock(&mtx); }
};
typedef mutex default_mutex;
#endif
template<class Mutex>
class scoped_lock
{
public:
scoped_lock(Mutex &m)
: m_(m)
{ m_.lock(); }
~scoped_lock()
{ m_.unlock(); }
private:
Mutex &m_;
};
include/boost/container/detail/node_alloc_holder.hpp view on Meta::CPAN
version<NodeAlloc>::value> alloc_version;
typedef typename ICont::iterator icont_iterator;
typedef typename ICont::const_iterator icont_citerator;
typedef allocator_destroyer<NodeAlloc> Destroyer;
typedef allocator_traits<NodeAlloc> NodeAllocTraits;
typedef allocator_version_traits<NodeAlloc> AllocVersionTraits;
private:
BOOST_COPYABLE_AND_MOVABLE(node_alloc_holder)
public:
//Constructors for sequence containers
node_alloc_holder()
: members_()
{}
explicit node_alloc_holder(const ValAlloc &a)
: members_(a)
{}
include/boost/container/detail/node_alloc_holder.hpp view on Meta::CPAN
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));
}
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()
{}
include/boost/container/detail/node_alloc_holder.hpp view on Meta::CPAN
{ return const_cast<ICont&>(this->members_.m_icont); }
NodeAlloc &node_alloc()
{ return static_cast<NodeAlloc &>(this->members_); }
const NodeAlloc &node_alloc() const
{ return static_cast<const NodeAlloc &>(this->members_); }
members_holder members_;
public:
ICont &icont()
{ return this->members_.m_icont; }
const ICont &icont() const
{ return this->members_.m_icont; }
};
} //namespace dtl {
} //namespace container {
} //namespace boost {
include/boost/container/detail/node_pool.hpp view on Meta::CPAN
namespace container {
namespace dtl {
//!Pooled memory allocator using single segregated storage. Includes
//!a reference count but the class does not delete itself, this is
//!responsibility of user classes. Node size (NodeSize) and the number of
//!nodes allocated per block (NodesPerBlock) are known at compile time
template< std::size_t NodeSize, std::size_t NodesPerBlock >
class private_node_pool
//Inherit from the implementation to avoid template bloat
: public boost::container::dtl::
private_node_pool_impl<fake_segment_manager>
{
typedef boost::container::dtl::
private_node_pool_impl<fake_segment_manager> base_t;
//Non-copyable
private_node_pool(const private_node_pool &);
private_node_pool &operator=(const private_node_pool &);
public:
typedef typename base_t::multiallocation_chain multiallocation_chain;
static const std::size_t nodes_per_block = NodesPerBlock;
//!Constructor from a segment manager. Never throws
private_node_pool()
: base_t(0, NodeSize, NodesPerBlock)
{}
};
template< std::size_t NodeSize
, std::size_t NodesPerBlock
>
class shared_node_pool
: public private_node_pool<NodeSize, NodesPerBlock>
{
private:
typedef private_node_pool<NodeSize, NodesPerBlock> private_node_allocator_t;
public:
typedef typename private_node_allocator_t::free_nodes_t free_nodes_t;
typedef typename private_node_allocator_t::multiallocation_chain multiallocation_chain;
//!Constructor from a segment manager. Never throws
shared_node_pool()
: private_node_allocator_t(){}
//!Destructor. Deallocates all allocated blocks. Never throws
~shared_node_pool()
{}
include/boost/container/detail/node_pool_impl.hpp view on Meta::CPAN
template<class SegmentManagerBase>
class private_node_pool_impl
{
//Non-copyable
private_node_pool_impl();
private_node_pool_impl(const private_node_pool_impl &);
private_node_pool_impl &operator=(const private_node_pool_impl &);
//A node object will hold node_t when it's not allocated
public:
typedef typename SegmentManagerBase::void_pointer void_pointer;
typedef typename node_slist<void_pointer>::slist_hook_t slist_hook_t;
typedef typename node_slist<void_pointer>::node_t node_t;
typedef typename node_slist<void_pointer>::node_slist_t free_nodes_t;
typedef typename SegmentManagerBase::multiallocation_chain multiallocation_chain;
typedef typename SegmentManagerBase::size_type size_type;
private:
typedef typename bi::make_slist
< node_t, bi::base_hook<slist_hook_t>
, bi::linear<true>
, bi::constant_time_size<false> >::type blockslist_t;
static size_type get_rounded_size(size_type orig_size, size_type round_to)
{ return ((orig_size-1)/round_to+1)*round_to; }
public:
//!Segment manager typedef
typedef SegmentManagerBase segment_manager_base_type;
//!Constructor from a segment manager. Never throws
private_node_pool_impl(segment_manager_base_type *segment_mngr_base, size_type node_size, size_type nodes_per_block)
: m_nodes_per_block(nodes_per_block)
, m_real_node_size(lcm(node_size, size_type(alignment_of<node_t>::value)))
//General purpose allocator
, mp_segment_mngr_base(segment_mngr_base)
include/boost/container/detail/pair.hpp view on Meta::CPAN
void get(T); //to enable ADL
///@endcond
template <class T1, class T2>
struct pair
{
private:
BOOST_COPYABLE_AND_MOVABLE(pair)
public:
typedef T1 first_type;
typedef T2 second_type;
T1 first;
T2 second;
//Default constructor
pair()
: first(), second()
{}
include/boost/container/detail/pair.hpp view on Meta::CPAN
//piecewise construction from variadic tuple (with delegating constructors)
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
# if !defined(BOOST_CONTAINER_NO_CXX11_DELEGATING_CONSTRUCTORS)
private:
template<template<class ...> class Tuple, class... Args1, class... Args2, size_t... Indexes1, size_t... Indexes2>
pair(Tuple<Args1...>& t1, Tuple<Args2...>& t2, index_tuple<Indexes1...>, index_tuple<Indexes2...>)
: first (::boost::forward<Args1>(get<Indexes1>(t1))...)
, second(::boost::forward<Args2>(get<Indexes2>(t2))...)
{ (void) t1; (void)t2; }
public:
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())
{}
# else
//piecewise construction from variadic tuple (suboptimal, without delegating constructors)
private:
template<typename T, template<class ...> class Tuple, typename... Args>
static T build_from_args(Tuple<Args...>&& t)
{ return do_build_from_args<T>(::boost::move(t), typename build_number_seq<sizeof...(Args)>::type()); }
template<typename T, template<class ...> class Tuple, typename... Args, std::size_t... Indexes>
static T do_build_from_args(Tuple<Args...> && t, const index_tuple<Indexes...>&)
{ (void)t; return T(::boost::forward<Args>(get<Indexes>(t))...); }
public:
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)))
{}
# endif //BOOST_NO_CXX11_VARIADIC_TEMPLATES
#elif defined(BOOST_MSVC) && (_CPPLIB_VER == 520)
//MSVC 2010 tuple implementation
#define BOOST_PAIR_PIECEWISE_CONSTRUCT_MSVC2010_TUPLE_CODE(N,M)\
include/boost/container/detail/pool_common_alloc.hpp view on Meta::CPAN
#include <boost/intrusive/slist.hpp>
#include <boost/container/detail/pool_common.hpp>
#include <boost/container/detail/dlmalloc.hpp>
#include <cstddef>
namespace boost{
namespace container{
namespace dtl{
struct node_slist_helper
: public boost::container::dtl::node_slist<void*>
{};
struct fake_segment_manager
{
typedef void * void_pointer;
static const std::size_t PayloadPerAllocation = BOOST_CONTAINER_ALLOCATION_PAYLOAD;
typedef boost::container::dtl::
basic_multiallocation_chain<void*> multiallocation_chain;
static void deallocate(void_pointer p)
include/boost/container/detail/pool_resource.hpp view on Meta::CPAN
std::size_t m_pool_count;
static void priv_limit_option(std::size_t &val, std::size_t min, std::size_t max);
static std::size_t priv_pool_index(std::size_t block_size);
static std::size_t priv_pool_block(std::size_t index);
void priv_fix_options();
void priv_init_pools();
void priv_constructor_body();
public:
//! <b>Requires</b>: `upstream` is the address of a valid memory resource.
//!
//! <b>Effects</b>: Constructs a pool resource object that will obtain memory
//! from upstream whenever the pool resource is unable to satisfy a memory
//! request from its own internal data structures. The resulting object will hold
//! a copy of upstream, but will not own the resource to which upstream points.
//! [ Note: The intention is that calls to upstream->allocate() will be
//! substantially fewer than calls to this->allocate() in most cases. - end note
//! The behavior of the pooling mechanism is tuned according to the value of
include/boost/container/detail/pool_resource.hpp view on Meta::CPAN
//! `pool_resource(opts, get_default_resource())`.
explicit pool_resource(const pool_options& opts) BOOST_NOEXCEPT;
#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
pool_resource(const pool_resource&) = delete;
pool_resource operator=(const pool_resource&) = delete;
#else
private:
pool_resource (const pool_resource&);
pool_resource operator=(const pool_resource&);
public:
#endif
//! <b>Effects</b>: Calls
//! `this->release()`.
virtual ~pool_resource();
//! <b>Effects</b>: Calls Calls `upstream_resource()->deallocate()` as necessary
//! to release all allocated memory. [ Note: memory is released back to
//! `upstream_resource()` even if deallocate has not been called for some
//! of the allocated blocks. - end note ]
include/boost/container/detail/pool_resource.hpp view on Meta::CPAN
//! <b>Returns</b>: The value of the upstream argument provided to the
//! constructor of this object.
memory_resource* upstream_resource() const;
//! <b>Returns</b>: The options that control the pooling behavior of this resource.
//! The values in the returned struct may differ from those supplied to the pool
//! resource constructor in that values of zero will be replaced with
//! implementation-defined defaults and sizes may be rounded to unspecified granularity.
pool_options options() const;
public: //public so that [un]synchronized_pool_resource can use them
//! <b>Returns</b>: A pointer to allocated storage with a size of at least `bytes`.
//! The size and alignment of the allocated memory shall meet the requirements for
//! a class derived from `memory_resource`.
//!
//! <b>Effects</b>: If the pool selected for a block of size bytes is unable to
//! satisfy the memory request from its own internal data structures, it will call
//! `upstream_resource()->allocate()` to obtain more memory. If `bytes` is larger
//! than that which the largest pool can handle, then memory will be allocated
//! using `upstream_resource()->allocate()`.
include/boost/container/detail/pool_resource.hpp view on Meta::CPAN
//! `upstream_resource()->deallocate()`.
//!
//! <b>Throws</b>: Nothing.
virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment);
//! <b>Returns</b>:
//! `this == dynamic_cast<const pool_resource*>(&other)`.
virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT;
//Non-standard observers
public:
//! <b>Returns</b>: The number of pools that will be used in the pool resource.
//!
//! <b>Note</b>: Non-standard extension.
std::size_t pool_count() const;
//! <b>Returns</b>: The index of the pool that will be used to serve the allocation of `bytes`.
//! from the pool specified by `pool_index`. Returns `pool_count()` if `bytes` is bigger
//! than `options().largest_required_pool_block` (no pool will be used to serve this).
//!
//! <b>Note</b>: Non-standard extension.
include/boost/container/detail/singleton.hpp view on Meta::CPAN
// This constructor does nothing more than ensure that instance()
// is called before main() begins, thus creating the static
// T object before multithreading race issues can come up.
object_creator() { singleton_default<T>::instance(); }
inline void do_nothing() const { }
};
static object_creator create_object;
singleton_default();
public:
typedef T object_type;
// If, at any point (in user code), singleton_default<T>::instance()
// is called, then the following function is instantiated.
static object_type & instance()
{
// This is the object that we return a reference to.
// It is guaranteed to be created before main() begins because of
// the next line.
static object_type obj;
include/boost/container/detail/thread_mutex.hpp view on Meta::CPAN
#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);
}
include/boost/container/detail/thread_mutex.hpp view on Meta::CPAN
} // 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()
include/boost/container/detail/transform_iterator.hpp view on Meta::CPAN
typedef T element_type;
T* operator->() const { return const_cast<T*>(&m_value); }
T &m_value;
};
template <class Iterator, class UnaryFunction>
class transform_iterator
: public UnaryFunction
, public boost::container::iterator
< typename Iterator::iterator_category
, typename dtl::remove_reference<typename UnaryFunction::result_type>::type
, typename Iterator::difference_type
, operator_arrow_proxy<typename UnaryFunction::result_type>
, typename UnaryFunction::result_type>
{
public:
explicit transform_iterator(const Iterator &it, const UnaryFunction &f = UnaryFunction())
: UnaryFunction(f), m_it(it)
{}
explicit transform_iterator()
: UnaryFunction(), m_it()
{}
//Constructors
transform_iterator& operator++()
include/boost/container/detail/tree.hpp view on Meta::CPAN
template<class T1, class T2>
struct tree_internal_data_type< std::pair<T1, T2> >
{
typedef pair<typename boost::move_detail::remove_const<T1>::type, T2> type;
};
//The node to be store in the tree
template <class T, class VoidPointer, boost::container::tree_type_enum tree_type_value, bool OptimizeSize>
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;
typedef T value_type;
typedef typename tree_internal_data_type<T>::type internal_type;
typedef tree_node< T, VoidPointer
, tree_type_value, OptimizeSize> node_t;
BOOST_CONTAINER_FORCEINLINE T &get_data()
{
include/boost/container/detail/tree.hpp view on Meta::CPAN
template <class T, class VoidPointer, boost::container::tree_type_enum tree_type_value, bool OptimizeSize>
struct iiterator_node_value_type< tree_node<T, VoidPointer, tree_type_value, OptimizeSize> > {
typedef T type;
};
template<class Node, class Icont>
class insert_equal_end_hint_functor
{
Icont &icont_;
public:
BOOST_CONTAINER_FORCEINLINE insert_equal_end_hint_functor(Icont &icont)
: icont_(icont)
{}
BOOST_CONTAINER_FORCEINLINE void operator()(Node &n)
{ this->icont_.insert_equal(this->icont_.cend(), n); }
};
template<class Node, class Icont>
class push_back_functor
{
Icont &icont_;
public:
BOOST_CONTAINER_FORCEINLINE push_back_functor(Icont &icont)
: icont_(icont)
{}
BOOST_CONTAINER_FORCEINLINE void operator()(Node &n)
{ this->icont_.push_back(n); }
};
}//namespace dtl {
include/boost/container/detail/tree.hpp view on Meta::CPAN
< value_type, void_pointer
, tree_type_value, OptimizeSize> node_t;
typedef value_to_node_compare
<node_t, ValueCompare> node_compare_type;
//Deducing the hook type from node_t (e.g. node_t::hook_type) would
//provoke an early instantiation of node_t that could ruin recursive
//tree definitions, so retype the complete type to avoid any problem.
typedef typename intrusive_tree_hook
<void_pointer, tree_type_value
, OptimizeSize>::type hook_type;
public:
typedef typename intrusive_tree_dispatch
< node_t, node_compare_type
, size_type, hook_type
, tree_type_value>::type type;
};
//Trait to detect manually rebalanceable tree types
template<boost::container::tree_type_enum tree_type_value>
struct is_manually_balanceable
{ static const bool value = true; };
include/boost/container/detail/tree.hpp view on Meta::CPAN
//already allocated nodes from a intrusive container instead of
//allocating new ones. When the intrusive container runs out of nodes
//the node holder is used instead.
template<class AllocHolder, bool DoMove>
class RecyclingCloner
{
typedef typename AllocHolder::intrusive_container intrusive_container;
typedef typename AllocHolder::Node node_t;
typedef typename AllocHolder::NodePtr node_ptr_type;
public:
RecyclingCloner(AllocHolder &holder, intrusive_container &itree)
: m_holder(holder), m_icont(itree)
{}
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); }
BOOST_CONTAINER_FORCEINLINE static void do_assign(node_ptr_type &p, const node_t &other, bool_<false>)
{ p->do_assign(other.m_data); }
include/boost/container/detail/tree.hpp view on Meta::CPAN
}
}
AllocHolder &m_holder;
intrusive_container &m_icont;
};
template<class KeyCompare, class KeyOfValue>
struct key_node_compare
: public boost::intrusive::detail::ebo_functor_holder<KeyCompare>
{
BOOST_CONTAINER_FORCEINLINE explicit key_node_compare(const KeyCompare &comp)
: base_t(comp)
{}
typedef boost::intrusive::detail::ebo_functor_holder<KeyCompare> base_t;
typedef KeyCompare key_compare;
typedef KeyOfValue key_of_value;
typedef typename KeyOfValue::type key_type;
include/boost/container/detail/tree.hpp view on Meta::CPAN
};
template<>
struct get_tree_opt<void>
{
typedef tree_assoc_defaults type;
};
template <class T, class KeyOfValue, class Compare, class Allocator, class Options>
class tree
: public dtl::node_alloc_holder
< Allocator
, typename dtl::intrusive_tree_type
< Allocator, tree_value_compare
<typename allocator_traits<Allocator>::pointer, Compare, KeyOfValue>
, get_tree_opt<Options>::type::tree_type
, get_tree_opt<Options>::type::optimize_size
>::type
>
{
typedef tree_value_compare
include/boost/container/detail/tree.hpp view on Meta::CPAN
typedef typename AllocHolder::ValAlloc ValAlloc;
typedef typename AllocHolder::Node Node;
typedef typename Icont::iterator iiterator;
typedef typename Icont::const_iterator iconst_iterator;
typedef dtl::allocator_destroyer<NodeAlloc> Destroyer;
typedef typename AllocHolder::alloc_version alloc_version;
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 boost::container::
allocator_traits<Allocator>::pointer pointer;
typedef typename boost::container::
allocator_traits<Allocator>::const_pointer const_pointer;
include/boost/container/detail/tree.hpp view on Meta::CPAN
< NodeAlloc, void> node_type;
typedef insert_return_type_base
<iterator, node_type> insert_return_type;
typedef NodeAlloc stored_allocator_type;
private:
typedef key_node_compare<key_compare, KeyOfValue> KeyNodeCompare;
public:
BOOST_CONTAINER_FORCEINLINE tree()
: AllocHolder()
{}
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)
include/boost/container/detail/tree.hpp view on Meta::CPAN
, dtl::is_input_iterator<InputIterator>
>::type * = 0
#endif
)
{
for ( ; first != last; ++first){
this->push_back_impl(*first);
}
}
public:
BOOST_CONTAINER_FORCEINLINE tree(const tree& 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::dtl::is_nothrow_move_constructible<Compare>::value)
include/boost/container/detail/tree.hpp view on Meta::CPAN
//If there are remaining nodes, destroy them
NodePtr p;
while((p = other_tree.unlink_leftmost_without_rebalance())){
AllocHolder::destroy_node(p);
}
}
return *this;
}
public:
// accessors:
BOOST_CONTAINER_FORCEINLINE value_compare value_comp() const
{ return this->icont().value_comp().predicate(); }
BOOST_CONTAINER_FORCEINLINE key_compare key_comp() const
{ return this->icont().value_comp().predicate().key_comp(); }
BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const
{ return allocator_type(this->node_alloc()); }
include/boost/container/detail/tree.hpp view on Meta::CPAN
{ return this->icont().size(); }
BOOST_CONTAINER_FORCEINLINE size_type max_size() const
{ return AllocHolder::max_size(); }
BOOST_CONTAINER_FORCEINLINE void swap(ThisType& x)
BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value
&& boost::container::dtl::is_nothrow_swappable<Compare>::value )
{ AllocHolder::swap(x); }
public:
typedef typename Icont::insert_commit_data insert_commit_data;
// insert/erase
std::pair<iterator,bool> insert_unique_check
(const key_type& key, insert_commit_data &data)
{
std::pair<iiterator, bool> ret =
this->icont().insert_unique_check(key, KeyNodeCompare(key_comp()), data);
return std::pair<iterator, bool>(iterator(ret.first), ret.second);
include/boost/container/detail/tree.hpp view on Meta::CPAN
insert_commit_data data;
std::pair<iterator,bool> ret =
this->insert_unique_check(hint, KeyOfValue()(v), data);
if(!ret.second){
Destroyer(this->node_alloc())(p);
return ret.first;
}
return iterator(this->icont().insert_unique_commit(*p, data));
}
public:
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <class... Args>
BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> emplace_unique(BOOST_FWD_REF(Args)... args)
{ return this->emplace_unique_impl(AllocHolder::create_node(boost::forward<Args>(args)...)); }
template <class... Args>
BOOST_CONTAINER_FORCEINLINE iterator emplace_hint_unique(const_iterator hint, BOOST_FWD_REF(Args)... args)
{ return this->emplace_unique_hint_impl(hint, AllocHolder::create_node(boost::forward<Args>(args)...)); }