update boost
This commit is contained in:
@@ -57,11 +57,7 @@ struct make_binomial_heap_base
|
||||
|
||||
typedef parent_pointing_heap_node<typename base_type::internal_type> node_type;
|
||||
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename allocator_argument::template rebind<node_type>::other allocator_type;
|
||||
#else
|
||||
typedef typename std::allocator_traits<allocator_argument>::template rebind_alloc<node_type> allocator_type;
|
||||
#endif
|
||||
typedef typename boost::allocator_rebind<allocator_argument, node_type>::type allocator_type;
|
||||
|
||||
struct type:
|
||||
base_type,
|
||||
@@ -162,14 +158,8 @@ private:
|
||||
typedef typename base_maker::allocator_type allocator_type;
|
||||
typedef typename base_maker::node_type node;
|
||||
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename allocator_type::pointer node_pointer;
|
||||
typedef typename allocator_type::const_pointer const_node_pointer;
|
||||
#else
|
||||
typedef std::allocator_traits<allocator_type> allocator_traits;
|
||||
typedef typename allocator_traits::pointer node_pointer;
|
||||
typedef typename allocator_traits::const_pointer const_node_pointer;
|
||||
#endif
|
||||
typedef typename boost::allocator_pointer<allocator_type>::type node_pointer;
|
||||
typedef typename boost::allocator_const_pointer<allocator_type>::type const_node_pointer;
|
||||
|
||||
typedef detail::node_handle<node_pointer, super_t, reference> handle_type;
|
||||
|
||||
@@ -210,9 +200,6 @@ public:
|
||||
typedef typename implementation_defined::difference_type difference_type;
|
||||
typedef typename implementation_defined::value_compare value_compare;
|
||||
typedef typename implementation_defined::allocator_type allocator_type;
|
||||
#ifndef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename implementation_defined::allocator_traits allocator_traits;
|
||||
#endif
|
||||
typedef typename implementation_defined::reference reference;
|
||||
typedef typename implementation_defined::const_reference const_reference;
|
||||
typedef typename implementation_defined::pointer pointer;
|
||||
@@ -317,12 +304,8 @@ public:
|
||||
/// \copydoc boost::heap::priority_queue::max_size
|
||||
size_type max_size(void) const
|
||||
{
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
return allocator_type::max_size();
|
||||
#else
|
||||
const allocator_type& alloc = *this;
|
||||
return allocator_traits::max_size(alloc);
|
||||
#endif
|
||||
return boost::allocator_max_size(alloc);
|
||||
}
|
||||
|
||||
/// \copydoc boost::heap::priority_queue::clear
|
||||
@@ -365,14 +348,9 @@ public:
|
||||
* */
|
||||
handle_type push(value_type const & v)
|
||||
{
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
node_pointer n = allocator_type::allocate(1);
|
||||
new(n) node_type(super_t::make_node(v));
|
||||
#else
|
||||
allocator_type& alloc = *this;
|
||||
node_pointer n = allocator_traits::allocate(alloc, 1);
|
||||
allocator_traits::construct(alloc, n, super_t::make_node(v));
|
||||
#endif
|
||||
node_pointer n = alloc.allocate(1);
|
||||
new(n) node_type(super_t::make_node(v));
|
||||
insert_node(trees.begin(), n);
|
||||
|
||||
if (!top_element || super_t::operator()(top_element->value, n->value))
|
||||
@@ -393,14 +371,9 @@ public:
|
||||
template <class... Args>
|
||||
handle_type emplace(Args&&... args)
|
||||
{
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
node_pointer n = allocator_type::allocate(1);
|
||||
new(n) node_type(super_t::make_node(std::forward<Args>(args)...));
|
||||
#else
|
||||
allocator_type& alloc = *this;
|
||||
node_pointer n = allocator_traits::allocate(alloc, 1);
|
||||
allocator_traits::construct(alloc, n, super_t::make_node(std::forward<Args>(args)...));
|
||||
#endif
|
||||
node_pointer n = alloc.allocate(1);
|
||||
new(n) node_type(super_t::make_node(std::forward<Args>(args)...));
|
||||
insert_node(trees.begin(), n);
|
||||
|
||||
if (!top_element || super_t::operator()(top_element->value, n->value))
|
||||
@@ -450,14 +423,9 @@ public:
|
||||
else
|
||||
update_top_element();
|
||||
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
element->~node_type();
|
||||
allocator_type::deallocate(element, 1);
|
||||
#else
|
||||
allocator_type& alloc = *this;
|
||||
allocator_traits::destroy(alloc, element);
|
||||
allocator_traits::deallocate(alloc, element, 1);
|
||||
#endif
|
||||
alloc.deallocate(element, 1);
|
||||
sanity_check();
|
||||
}
|
||||
|
||||
|
||||
@@ -66,11 +66,7 @@ class d_ary_heap:
|
||||
typedef typename heap_base_maker::type super_t;
|
||||
typedef typename super_t::internal_type internal_type;
|
||||
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename heap_base_maker::allocator_argument::template rebind<internal_type>::other internal_type_allocator;
|
||||
#else
|
||||
typedef typename std::allocator_traits<typename heap_base_maker::allocator_argument>::template rebind_alloc<internal_type> internal_type_allocator;
|
||||
#endif
|
||||
typedef typename boost::allocator_rebind<typename heap_base_maker::allocator_argument, internal_type>::type internal_type_allocator;
|
||||
typedef std::vector<internal_type, internal_type_allocator> container_type;
|
||||
typedef typename container_type::const_iterator container_iterator;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <boost/intrusive/list.hpp>
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
|
||||
@@ -82,6 +83,12 @@ std::size_t count_nodes(const Node * n)
|
||||
return 1 + count_list_nodes<Node, typename Node::child_list>(n->children);
|
||||
}
|
||||
|
||||
template<class Node>
|
||||
void destroy_node(Node& node)
|
||||
{
|
||||
node.~Node();
|
||||
}
|
||||
|
||||
|
||||
/* node cloner
|
||||
*
|
||||
@@ -98,35 +105,21 @@ template <typename Node,
|
||||
typename Alloc>
|
||||
struct node_cloner
|
||||
{
|
||||
#ifndef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef std::allocator_traits<Alloc> allocator_traits;
|
||||
#endif
|
||||
|
||||
node_cloner(Alloc & allocator):
|
||||
allocator(allocator)
|
||||
{}
|
||||
|
||||
Node * operator() (NodeBase const & node)
|
||||
{
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
Node * ret = allocator.allocate(1);
|
||||
new (ret) Node(static_cast<Node const &>(node), allocator);
|
||||
#else
|
||||
Node * ret = allocator_traits::allocate(allocator, 1);
|
||||
allocator_traits::construct(allocator, ret, static_cast<Node const &>(node), allocator);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
Node * operator() (NodeBase const & node, Node * parent)
|
||||
{
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
Node * ret = allocator.allocate(1);
|
||||
new (ret) Node(static_cast<Node const &>(node), allocator, parent);
|
||||
#else
|
||||
Node * ret = allocator_traits::allocate(allocator, 1);
|
||||
allocator_traits::construct(allocator, ret, static_cast<Node const &>(node), allocator, parent);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -145,12 +138,7 @@ template <typename Node,
|
||||
typename Alloc>
|
||||
struct node_disposer
|
||||
{
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename Alloc::pointer node_pointer;
|
||||
#else
|
||||
typedef std::allocator_traits<Alloc> allocator_traits;
|
||||
typedef typename allocator_traits::pointer node_pointer;
|
||||
#endif
|
||||
typedef typename boost::allocator_pointer<Alloc>::type node_pointer;
|
||||
|
||||
node_disposer(Alloc & alloc):
|
||||
alloc_(alloc)
|
||||
@@ -160,13 +148,8 @@ struct node_disposer
|
||||
{
|
||||
node_pointer n = static_cast<node_pointer>(base);
|
||||
n->clear_subtree(alloc_);
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
alloc_.destroy(n);
|
||||
boost::heap::detail::destroy_node(*n);
|
||||
alloc_.deallocate(n, 1);
|
||||
#else
|
||||
allocator_traits::destroy(alloc_, n);
|
||||
allocator_traits::deallocate(alloc_, n, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
Alloc & alloc_;
|
||||
|
||||
@@ -47,11 +47,7 @@ public:
|
||||
private:
|
||||
typedef std::pair<value_type, size_type> node_type;
|
||||
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef std::list<node_type, typename allocator_type::template rebind<node_type>::other> object_list;
|
||||
#else
|
||||
typedef std::list<node_type, typename std::allocator_traits<allocator_type>::template rebind_alloc<node_type>> object_list;
|
||||
#endif
|
||||
typedef std::list<node_type, typename boost::allocator_rebind<allocator_type, node_type>::type> object_list;
|
||||
|
||||
typedef typename object_list::iterator list_iterator;
|
||||
typedef typename object_list::const_iterator const_list_iterator;
|
||||
@@ -300,11 +296,7 @@ public:
|
||||
}
|
||||
|
||||
std::priority_queue<iterator,
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
std::vector<iterator, typename allocator_type::template rebind<iterator>::other >,
|
||||
#else
|
||||
std::vector<iterator, typename std::allocator_traits<allocator_type>::template rebind_alloc<iterator> >,
|
||||
#endif
|
||||
std::vector<iterator, typename boost::allocator_rebind<allocator_type, iterator>::type>,
|
||||
indirect_cmp
|
||||
> unvisited_nodes;
|
||||
const priority_queue_mutable_wrapper * q_;
|
||||
|
||||
@@ -133,11 +133,7 @@ private:
|
||||
}
|
||||
|
||||
std::priority_queue<size_t,
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
std::vector<size_t, typename Alloc::template rebind<size_t>::other >,
|
||||
#else
|
||||
std::vector<size_t, typename std::allocator_traits<Alloc>::template rebind_alloc<size_t> >,
|
||||
#endif
|
||||
std::vector<size_t, typename boost::allocator_rebind<Alloc, size_t>::type>,
|
||||
compare_by_heap_value
|
||||
> unvisited_nodes;
|
||||
};
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
|
||||
#include <boost/heap/policies.hpp>
|
||||
@@ -173,19 +174,21 @@ struct heap_base:
|
||||
heap_base(heap_base && rhs) BOOST_NOEXCEPT_IF(boost::is_nothrow_move_constructible<Cmp>::value):
|
||||
#ifndef BOOST_MSVC
|
||||
Cmp(std::move(static_cast<Cmp&>(rhs))),
|
||||
#else
|
||||
cmp_(std::move(rhs.cmp_)),
|
||||
#endif
|
||||
size_holder_type(std::move(static_cast<size_holder_type&>(rhs)))
|
||||
#ifdef BOOST_MSVC
|
||||
, cmp_(std::move(rhs.cmp_))
|
||||
#endif
|
||||
{}
|
||||
|
||||
heap_base(heap_base const & rhs):
|
||||
#ifndef BOOST_MSVC
|
||||
Cmp(static_cast<Cmp const &>(rhs)),
|
||||
#else
|
||||
cmp_(rhs.value_comp()),
|
||||
#endif
|
||||
size_holder_type(static_cast<size_holder_type const &>(rhs))
|
||||
#ifdef BOOST_MSVC
|
||||
, cmp_(rhs.value_comp())
|
||||
#endif
|
||||
{}
|
||||
|
||||
heap_base & operator=(heap_base && rhs) BOOST_NOEXCEPT_IF(boost::is_nothrow_move_assignable<Cmp>::value)
|
||||
@@ -566,22 +569,12 @@ struct make_heap_base
|
||||
template <typename Alloc>
|
||||
struct extract_allocator_types
|
||||
{
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename Alloc::size_type size_type;
|
||||
typedef typename Alloc::difference_type difference_type;
|
||||
typedef typename Alloc::reference reference;
|
||||
typedef typename Alloc::const_reference const_reference;
|
||||
typedef typename Alloc::pointer pointer;
|
||||
typedef typename Alloc::const_pointer const_pointer;
|
||||
#else
|
||||
typedef std::allocator_traits<Alloc> traits;
|
||||
typedef typename traits::size_type size_type;
|
||||
typedef typename traits::difference_type difference_type;
|
||||
typedef typename boost::allocator_size_type<Alloc>::type size_type;
|
||||
typedef typename boost::allocator_difference_type<Alloc>::type difference_type;
|
||||
typedef typename Alloc::value_type& reference;
|
||||
typedef typename Alloc::value_type const& const_reference;
|
||||
typedef typename traits::pointer pointer;
|
||||
typedef typename traits::const_pointer const_pointer;
|
||||
#endif
|
||||
typedef typename boost::allocator_pointer<Alloc>::type pointer;
|
||||
typedef typename boost::allocator_const_pointer<Alloc>::type const_pointer;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
#include <queue>
|
||||
@@ -81,11 +82,7 @@ struct unordered_tree_iterator_storage
|
||||
return data_.empty();
|
||||
}
|
||||
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
std::vector<HandleType, typename Alloc::template rebind<HandleType>::other > data_;
|
||||
#else
|
||||
std::vector<HandleType, typename std::allocator_traits<Alloc>::template rebind_alloc<HandleType> > data_;
|
||||
#endif
|
||||
std::vector<HandleType, typename boost::allocator_rebind<Alloc, HandleType>::type> data_;
|
||||
};
|
||||
|
||||
template <typename ValueType,
|
||||
@@ -138,11 +135,7 @@ struct ordered_tree_iterator_storage:
|
||||
}
|
||||
|
||||
std::priority_queue<HandleType,
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
std::vector<HandleType, typename Alloc::template rebind<HandleType>::other>,
|
||||
#else
|
||||
std::vector<HandleType, typename std::allocator_traits<Alloc>::template rebind_alloc<HandleType> >,
|
||||
#endif
|
||||
std::vector<HandleType, typename boost::allocator_rebind<Alloc, HandleType>::type>,
|
||||
compare_values_by_handle> data_;
|
||||
};
|
||||
|
||||
|
||||
@@ -59,11 +59,7 @@ struct make_fibonacci_heap_base
|
||||
typedef typename detail::make_heap_base<T, Parspec, constant_time_size>::compare_argument compare_argument;
|
||||
typedef marked_heap_node<typename base_type::internal_type> node_type;
|
||||
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename allocator_argument::template rebind<node_type>::other allocator_type;
|
||||
#else
|
||||
typedef typename std::allocator_traits<allocator_argument>::template rebind_alloc<node_type> allocator_type;
|
||||
#endif
|
||||
typedef typename boost::allocator_rebind<allocator_argument, node_type>::type allocator_type;
|
||||
|
||||
struct type:
|
||||
base_type,
|
||||
@@ -159,14 +155,8 @@ private:
|
||||
typedef typename base_maker::compare_argument value_compare;
|
||||
typedef typename base_maker::allocator_type allocator_type;
|
||||
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename allocator_type::pointer node_pointer;
|
||||
typedef typename allocator_type::const_pointer const_node_pointer;
|
||||
#else
|
||||
typedef std::allocator_traits<allocator_type> allocator_traits;
|
||||
typedef typename allocator_traits::pointer node_pointer;
|
||||
typedef typename allocator_traits::const_pointer const_node_pointer;
|
||||
#endif
|
||||
typedef typename boost::allocator_pointer<allocator_type>::type node_pointer;
|
||||
typedef typename boost::allocator_const_pointer<allocator_type>::type const_node_pointer;
|
||||
|
||||
typedef detail::heap_node_list node_list_type;
|
||||
typedef typename node_list_type::iterator node_list_iterator;
|
||||
@@ -212,9 +202,6 @@ public:
|
||||
typedef typename implementation_defined::difference_type difference_type;
|
||||
typedef typename implementation_defined::value_compare value_compare;
|
||||
typedef typename implementation_defined::allocator_type allocator_type;
|
||||
#ifndef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename implementation_defined::allocator_traits allocator_traits;
|
||||
#endif
|
||||
typedef typename implementation_defined::reference reference;
|
||||
typedef typename implementation_defined::const_reference const_reference;
|
||||
typedef typename implementation_defined::pointer pointer;
|
||||
@@ -313,12 +300,8 @@ public:
|
||||
/// \copydoc boost::heap::priority_queue::max_size
|
||||
size_type max_size(void) const
|
||||
{
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
return allocator_type::max_size();
|
||||
#else
|
||||
const allocator_type& alloc = *this;
|
||||
return allocator_traits::max_size(alloc);
|
||||
#endif
|
||||
return boost::allocator_max_size(alloc);
|
||||
}
|
||||
|
||||
/// \copydoc boost::heap::priority_queue::clear
|
||||
@@ -366,14 +349,9 @@ public:
|
||||
{
|
||||
size_holder::increment();
|
||||
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
node_pointer n = allocator_type::allocate(1);
|
||||
new(n) node(super_t::make_node(v));
|
||||
#else
|
||||
allocator_type& alloc = *this;
|
||||
node_pointer n = allocator_traits::allocate(alloc, 1);
|
||||
allocator_traits::construct(alloc, n, super_t::make_node(v));
|
||||
#endif
|
||||
node_pointer n = alloc.allocate(1);
|
||||
new(n) node(super_t::make_node(v));
|
||||
roots.push_front(*n);
|
||||
|
||||
if (!top_element || super_t::operator()(top_element->value, n->value))
|
||||
@@ -395,14 +373,9 @@ public:
|
||||
{
|
||||
size_holder::increment();
|
||||
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
node_pointer n = allocator_type::allocate(1);
|
||||
new(n) node(super_t::make_node(std::forward<Args>(args)...));
|
||||
#else
|
||||
allocator_type& alloc = *this;
|
||||
node_pointer n = allocator_traits::allocate(alloc, 1);
|
||||
allocator_traits::construct(alloc, n, super_t::make_node(std::forward<Args>(args)...));
|
||||
#endif
|
||||
node_pointer n = alloc.allocate(1);
|
||||
new(n) node(super_t::make_node(std::forward<Args>(args)...));
|
||||
roots.push_front(*n);
|
||||
|
||||
if (!top_element || super_t::operator()(top_element->value, n->value))
|
||||
@@ -770,14 +743,9 @@ private:
|
||||
{
|
||||
add_children_to_root(erased_node);
|
||||
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
erased_node->~node();
|
||||
allocator_type::deallocate(erased_node, 1);
|
||||
#else
|
||||
allocator_type& alloc = *this;
|
||||
allocator_traits::destroy(alloc, erased_node);
|
||||
allocator_traits::deallocate(alloc, erased_node, 1);
|
||||
#endif
|
||||
alloc.deallocate(erased_node, 1);
|
||||
|
||||
size_holder::decrement();
|
||||
if (!empty())
|
||||
|
||||
@@ -59,11 +59,7 @@ struct make_pairing_heap_base
|
||||
|
||||
typedef heap_node<typename base_type::internal_type, false> node_type;
|
||||
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename allocator_argument::template rebind<node_type>::other allocator_type;
|
||||
#else
|
||||
typedef typename std::allocator_traits<allocator_argument>::template rebind_alloc<node_type> allocator_type;
|
||||
#endif
|
||||
typedef typename boost::allocator_rebind<allocator_argument, node_type>::type allocator_type;
|
||||
|
||||
struct type:
|
||||
base_type,
|
||||
@@ -163,14 +159,8 @@ private:
|
||||
typedef typename base_maker::compare_argument value_compare;
|
||||
typedef typename base_maker::allocator_type allocator_type;
|
||||
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename allocator_type::pointer node_pointer;
|
||||
typedef typename allocator_type::const_pointer const_node_pointer;
|
||||
#else
|
||||
typedef std::allocator_traits<allocator_type> allocator_traits;
|
||||
typedef typename allocator_traits::pointer node_pointer;
|
||||
typedef typename allocator_traits::const_pointer const_node_pointer;
|
||||
#endif
|
||||
typedef typename boost::allocator_pointer<allocator_type>::type node_pointer;
|
||||
typedef typename boost::allocator_const_pointer<allocator_type>::type const_node_pointer;
|
||||
|
||||
typedef detail::heap_node_list node_list_type;
|
||||
typedef typename node_list_type::iterator node_list_iterator;
|
||||
@@ -224,9 +214,6 @@ public:
|
||||
typedef typename implementation_defined::difference_type difference_type;
|
||||
typedef typename implementation_defined::value_compare value_compare;
|
||||
typedef typename implementation_defined::allocator_type allocator_type;
|
||||
#ifndef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename implementation_defined::allocator_traits allocator_traits;
|
||||
#endif
|
||||
typedef typename implementation_defined::reference reference;
|
||||
typedef typename implementation_defined::const_reference const_reference;
|
||||
typedef typename implementation_defined::pointer pointer;
|
||||
@@ -316,12 +303,8 @@ public:
|
||||
/// \copydoc boost::heap::priority_queue::max_size
|
||||
size_type max_size(void) const
|
||||
{
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
return allocator_type::max_size();
|
||||
#else
|
||||
const allocator_type& alloc = *this;
|
||||
return allocator_traits::max_size(alloc);
|
||||
#endif
|
||||
return boost::allocator_max_size(alloc);
|
||||
}
|
||||
|
||||
/// \copydoc boost::heap::priority_queue::clear
|
||||
@@ -331,14 +314,9 @@ public:
|
||||
return;
|
||||
|
||||
root->template clear_subtree<allocator_type>(*this);
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
root->~node();
|
||||
allocator_type::deallocate(root, 1);
|
||||
#else
|
||||
allocator_type& alloc = *this;
|
||||
allocator_traits::destroy(alloc, root);
|
||||
allocator_traits::deallocate(alloc, root, 1);
|
||||
#endif
|
||||
alloc.deallocate(root, 1);
|
||||
root = NULL;
|
||||
size_holder::set_size(0);
|
||||
}
|
||||
@@ -379,14 +357,9 @@ public:
|
||||
{
|
||||
size_holder::increment();
|
||||
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
node_pointer n = allocator_type::allocate(1);
|
||||
new(n) node(super_t::make_node(v));
|
||||
#else
|
||||
allocator_type& alloc = *this;
|
||||
node_pointer n = allocator_traits::allocate(alloc, 1);
|
||||
allocator_traits::construct(alloc, n, super_t::make_node(v));
|
||||
#endif
|
||||
node_pointer n = alloc.allocate(1);
|
||||
new(n) node(super_t::make_node(v));
|
||||
merge_node(n);
|
||||
return handle_type(n);
|
||||
}
|
||||
@@ -407,14 +380,9 @@ public:
|
||||
{
|
||||
size_holder::increment();
|
||||
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
node_pointer n = allocator_type::allocate(1);
|
||||
new(n) node(super_t::make_node(std::forward<Args>(args)...));
|
||||
#else
|
||||
allocator_type& alloc = *this;
|
||||
node_pointer n = allocator_traits::allocate(alloc, 1);
|
||||
allocator_traits::construct(alloc, n, super_t::make_node(std::forward<Args>(args)...));
|
||||
#endif
|
||||
node_pointer n = alloc.allocate(1);
|
||||
new(n) node(super_t::make_node(std::forward<Args>(args)...));
|
||||
merge_node(n);
|
||||
return handle_type(n);
|
||||
}
|
||||
@@ -560,14 +528,9 @@ public:
|
||||
}
|
||||
|
||||
size_holder::decrement();
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
n->~node();
|
||||
allocator_type::deallocate(n, 1);
|
||||
#else
|
||||
allocator_type& alloc = *this;
|
||||
allocator_traits::destroy(alloc, n);
|
||||
allocator_traits::deallocate(alloc, n, 1);
|
||||
#endif
|
||||
alloc.deallocate(n, 1);
|
||||
}
|
||||
|
||||
/// \copydoc boost::heap::priority_queue::begin
|
||||
|
||||
@@ -9,8 +9,12 @@
|
||||
#ifndef BOOST_HEAP_POLICIES_HPP
|
||||
#define BOOST_HEAP_POLICIES_HPP
|
||||
|
||||
#include <boost/parameter.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <boost/parameter/name.hpp>
|
||||
#include <boost/parameter/template_keyword.hpp>
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/parameter/binding.hpp>
|
||||
#include <boost/parameter/parameters.hpp>
|
||||
#include <boost/type_traits/conditional.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
#include <boost/type_traits/is_void.hpp>
|
||||
|
||||
@@ -67,11 +67,7 @@ class priority_queue:
|
||||
|
||||
typedef typename heap_base_maker::type super_t;
|
||||
typedef typename super_t::internal_type internal_type;
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename heap_base_maker::allocator_argument::template rebind<internal_type>::other internal_type_allocator;
|
||||
#else
|
||||
typedef typename std::allocator_traits<typename heap_base_maker::allocator_argument>::template rebind_alloc<internal_type> internal_type_allocator;
|
||||
#endif
|
||||
typedef typename boost::allocator_rebind<typename heap_base_maker::allocator_argument, internal_type>::type internal_type_allocator;
|
||||
typedef std::vector<internal_type, internal_type_allocator> container_type;
|
||||
|
||||
template <typename Heap1, typename Heap2>
|
||||
@@ -87,9 +83,6 @@ class priority_queue:
|
||||
typedef detail::stable_heap_iterator<T, typename container_type::const_iterator, super_t> iterator;
|
||||
typedef iterator const_iterator;
|
||||
typedef typename container_type::allocator_type allocator_type;
|
||||
#ifndef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename std::allocator_traits<allocator_type> allocator_traits;
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -99,9 +92,6 @@ public:
|
||||
typedef typename implementation_defined::difference_type difference_type;
|
||||
typedef typename implementation_defined::value_compare value_compare;
|
||||
typedef typename implementation_defined::allocator_type allocator_type;
|
||||
#ifndef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename implementation_defined::allocator_traits allocator_traits;
|
||||
#endif
|
||||
typedef typename implementation_defined::reference reference;
|
||||
typedef typename implementation_defined::const_reference const_reference;
|
||||
typedef typename implementation_defined::pointer pointer;
|
||||
|
||||
@@ -193,11 +193,7 @@ struct make_skew_heap_base
|
||||
|
||||
typedef skew_heap_node<typename base_type::internal_type, store_parent_pointer> node_type;
|
||||
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename allocator_argument::template rebind<node_type>::other allocator_type;
|
||||
#else
|
||||
typedef typename std::allocator_traits<allocator_argument>::template rebind_alloc<node_type> allocator_type;
|
||||
#endif
|
||||
typedef typename boost::allocator_rebind<allocator_argument, node_type>::type allocator_type;
|
||||
|
||||
struct type:
|
||||
base_type,
|
||||
@@ -295,14 +291,8 @@ class skew_heap:
|
||||
typedef typename base_maker::allocator_type allocator_type;
|
||||
|
||||
typedef typename base_maker::node_type node;
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename allocator_type::pointer node_pointer;
|
||||
typedef typename allocator_type::const_pointer const_node_pointer;
|
||||
#else
|
||||
typedef std::allocator_traits<allocator_type> allocator_traits;
|
||||
typedef typename allocator_traits::pointer node_pointer;
|
||||
typedef typename allocator_traits::const_pointer const_node_pointer;
|
||||
#endif
|
||||
typedef typename boost::allocator_pointer<allocator_type>::type node_pointer;
|
||||
typedef typename boost::allocator_const_pointer<allocator_type>::type const_node_pointer;
|
||||
|
||||
typedef detail::value_extractor<value_type, internal_type, super_t> value_extractor;
|
||||
|
||||
@@ -356,9 +346,6 @@ public:
|
||||
typedef typename implementation_defined::difference_type difference_type;
|
||||
typedef typename implementation_defined::value_compare value_compare;
|
||||
typedef typename implementation_defined::allocator_type allocator_type;
|
||||
#ifndef BOOST_NO_CXX11_ALLOCATOR
|
||||
typedef typename implementation_defined::allocator_traits allocator_traits;
|
||||
#endif
|
||||
typedef typename implementation_defined::reference reference;
|
||||
typedef typename implementation_defined::const_reference const_reference;
|
||||
typedef typename implementation_defined::pointer pointer;
|
||||
@@ -476,12 +463,8 @@ public:
|
||||
/// \copydoc boost::heap::priority_queue::max_size
|
||||
size_type max_size(void) const
|
||||
{
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
return allocator_type::max_size();
|
||||
#else
|
||||
const allocator_type& alloc = *this;
|
||||
return allocator_traits::max_size(alloc);
|
||||
#endif
|
||||
return boost::allocator_max_size(alloc);
|
||||
}
|
||||
|
||||
/// \copydoc boost::heap::priority_queue::clear
|
||||
@@ -491,14 +474,9 @@ public:
|
||||
return;
|
||||
|
||||
root->template clear_subtree<allocator_type>(*this);
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
root->~node();
|
||||
allocator_type::deallocate(root, 1);
|
||||
#else
|
||||
allocator_type& alloc = *this;
|
||||
allocator_traits::destroy(alloc, root);
|
||||
allocator_traits::deallocate(alloc, root, 1);
|
||||
#endif
|
||||
alloc.deallocate(root, 1);
|
||||
root = NULL;
|
||||
size_holder::set_size(0);
|
||||
}
|
||||
@@ -545,14 +523,8 @@ public:
|
||||
BOOST_HEAP_ASSERT(size_holder::get_size() == 0);
|
||||
|
||||
top->~node();
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
top->~node();
|
||||
allocator_type::deallocate(top, 1);
|
||||
#else
|
||||
allocator_type& alloc = *this;
|
||||
allocator_traits::destroy(alloc, top);
|
||||
allocator_traits::deallocate(alloc, top, 1);
|
||||
#endif
|
||||
alloc.deallocate(top, 1);
|
||||
sanity_check();
|
||||
}
|
||||
|
||||
@@ -673,14 +645,9 @@ public:
|
||||
size_holder::decrement();
|
||||
|
||||
sanity_check();
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
this_node->~node();
|
||||
allocator_type::deallocate(this_node, 1);
|
||||
#else
|
||||
allocator_type& alloc = *this;
|
||||
allocator_traits::destroy(alloc, this_node);
|
||||
allocator_traits::deallocate(alloc, this_node, 1);
|
||||
#endif
|
||||
alloc.deallocate(this_node, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -831,14 +798,9 @@ private:
|
||||
{
|
||||
size_holder::increment();
|
||||
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
node_pointer n = allocator_type::allocate(1);
|
||||
new(n) node(super_t::make_node(v));
|
||||
#else
|
||||
allocator_type& alloc = *this;
|
||||
node_pointer n = allocator_traits::allocate(alloc, 1);
|
||||
allocator_traits::construct(alloc, n, super_t::make_node(v));
|
||||
#endif
|
||||
node_pointer n = alloc.allocate(1);
|
||||
new(n) node(super_t::make_node(v));
|
||||
merge_node(n);
|
||||
return n;
|
||||
}
|
||||
@@ -849,14 +811,9 @@ private:
|
||||
{
|
||||
size_holder::increment();
|
||||
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
node_pointer n = allocator_type::allocate(1);
|
||||
new(n) node(super_t::make_node(std::forward<Args>(args)...));
|
||||
#else
|
||||
allocator_type& alloc = *this;
|
||||
node_pointer n = allocator_traits::allocate(alloc, 1);
|
||||
allocator_traits::construct(alloc, n, super_t::make_node(std::forward<Args>(args)...));
|
||||
#endif
|
||||
node_pointer n = alloc.allocate(1);
|
||||
new(n) node(super_t::make_node(std::forward<Args>(args)...));
|
||||
merge_node(n);
|
||||
return n;
|
||||
}
|
||||
@@ -884,13 +841,8 @@ private:
|
||||
return;
|
||||
|
||||
allocator_type& alloc = *this;
|
||||
#ifdef BOOST_NO_CXX11_ALLOCATOR
|
||||
root = allocator_type::allocate(1);
|
||||
root = alloc.allocate(1);
|
||||
new(root) node(*rhs.root, alloc, NULL);
|
||||
#else
|
||||
root = allocator_traits::allocate(alloc, 1);
|
||||
allocator_traits::construct(alloc, root, *rhs.root, alloc, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
void merge_node(node_pointer other)
|
||||
|
||||
Reference in New Issue
Block a user