update boost on linux

This commit is contained in:
Bassem Girgis
2019-08-10 16:06:25 -05:00
parent 76ad52be58
commit 861b918727
5363 changed files with 483306 additions and 116507 deletions

View File

@@ -19,6 +19,7 @@
#include <boost/heap/detail/heap_node.hpp>
#include <boost/heap/detail/stable_heap.hpp>
#include <boost/heap/detail/tree_iterator.hpp>
#include <boost/type_traits/integral_constant.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
@@ -48,7 +49,7 @@ struct make_binomial_heap_base
{
static const bool constant_time_size = parameter::binding<Parspec,
tag::constant_time_size,
boost::mpl::true_
boost::true_type
>::type::value;
typedef typename detail::make_heap_base<T, Parspec, constant_time_size>::type base_type;
typedef typename detail::make_heap_base<T, Parspec, constant_time_size>::allocator_argument allocator_argument;
@@ -56,7 +57,11 @@ 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
struct type:
base_type,
@@ -157,8 +162,14 @@ 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 detail::node_handle<node_pointer, super_t, reference> handle_type;
@@ -199,6 +210,9 @@ 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;
@@ -303,7 +317,12 @@ 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
}
/// \copydoc boost::heap::priority_queue::clear
@@ -346,9 +365,14 @@ 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
insert_node(trees.begin(), n);
if (!top_element || super_t::operator()(top_element->value, n->value))
@@ -369,9 +393,14 @@ 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
insert_node(trees.begin(), n);
if (!top_element || super_t::operator()(top_element->value, n->value))
@@ -421,8 +450,14 @@ 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
sanity_check();
}

View File

@@ -1,4 +1,4 @@
// // boost heap: d-ary heap as containter adaptor
// // boost heap: d-ary heap as container adaptor
//
// Copyright (C) 2010 Tim Blechmann
//
@@ -66,7 +66,11 @@ 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 std::vector<internal_type, internal_type_allocator> container_type;
typedef typename container_type::const_iterator container_iterator;
@@ -421,7 +425,7 @@ struct select_dary_heap
{
static const bool is_mutable = extract_mutable<BoundArgs>::value;
typedef typename mpl::if_c< is_mutable,
typedef typename boost::conditional< is_mutable,
priority_queue_mutable_wrapper<d_ary_heap<T, BoundArgs, nop_index_updater > >,
d_ary_heap<T, BoundArgs, nop_index_updater >
>::type type;
@@ -585,7 +589,7 @@ public:
}
/// \copydoc boost::heap::priority_queue::push
typename mpl::if_c<is_mutable, handle_type, void>::type push(value_type const & v)
typename boost::conditional<is_mutable, handle_type, void>::type push(value_type const & v)
{
return super_t::push(v);
}
@@ -593,7 +597,7 @@ public:
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
/// \copydoc boost::heap::priority_queue::emplace
template <class... Args>
typename mpl::if_c<is_mutable, handle_type, void>::type emplace(Args&&... args)
typename boost::conditional<is_mutable, handle_type, void>::type emplace(Args&&... args)
{
return super_t::emplace(std::forward<Args>(args)...);
}

View File

@@ -13,6 +13,7 @@
#include <boost/static_assert.hpp>
#include <boost/concept/assert.hpp>
#include <boost/heap/heap_concepts.hpp>
#include <boost/type_traits/conditional.hpp>
#ifdef BOOST_HEAP_SANITYCHECKS
#define BOOST_HEAP_ASSERT BOOST_ASSERT
@@ -136,7 +137,7 @@ bool heap_equality(Heap1 const & lhs, Heap2 const & rhs)
{
const bool use_ordered_iterators = Heap1::has_ordered_iterators && Heap2::has_ordered_iterators;
typedef typename boost::mpl::if_c<use_ordered_iterators,
typedef typename boost::conditional<use_ordered_iterators,
heap_equivalence_iteration,
heap_equivalence_copy
>::type equivalence_check;
@@ -225,7 +226,7 @@ bool heap_compare(Heap1 const & lhs, Heap2 const & rhs)
{
const bool use_ordered_iterators = Heap1::has_ordered_iterators && Heap2::has_ordered_iterators;
typedef typename boost::mpl::if_c<use_ordered_iterators,
typedef typename boost::conditional<use_ordered_iterators,
heap_compare_iteration,
heap_compare_copy
>::type compare_check;

View File

@@ -12,7 +12,7 @@
#include <boost/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/intrusive/list.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/conditional.hpp>
#ifdef BOOST_HEAP_SANITYCHECKS
#define BOOST_HEAP_ASSERT BOOST_ASSERT
@@ -26,11 +26,10 @@ namespace heap {
namespace detail {
namespace bi = boost::intrusive;
namespace mpl = boost::mpl;
template <bool auto_unlink = false>
struct heap_node_base:
bi::list_base_hook<typename mpl::if_c<auto_unlink,
bi::list_base_hook<typename boost::conditional<auto_unlink,
bi::link_mode<bi::auto_unlink>,
bi::link_mode<bi::safe_link>
>::type
@@ -99,21 +98,35 @@ 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;
}
@@ -132,7 +145,12 @@ 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
node_disposer(Alloc & alloc):
alloc_(alloc)
@@ -142,8 +160,13 @@ struct node_disposer
{
node_pointer n = static_cast<node_pointer>(base);
n->clear_subtree(alloc_);
#ifdef BOOST_NO_CXX11_ALLOCATOR
alloc_.destroy(n);
alloc_.deallocate(n, 1);
#else
allocator_traits::destroy(alloc_, n);
allocator_traits::deallocate(alloc_, n, 1);
#endif
}
Alloc & alloc_;

View File

@@ -47,7 +47,11 @@ 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 typename object_list::iterator list_iterator;
typedef typename object_list::const_iterator const_list_iterator;
@@ -296,7 +300,11 @@ 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
indirect_cmp
> unvisited_nodes;
const priority_queue_mutable_wrapper * q_;

View File

@@ -133,7 +133,11 @@ 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
compare_by_heap_value
> unvisited_nodes;
};

View File

@@ -566,12 +566,22 @@ 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 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
};

View File

@@ -13,6 +13,7 @@
#include <vector>
#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/type_traits/conditional.hpp>
#include <queue>
namespace boost {
@@ -80,7 +81,11 @@ 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
};
template <typename ValueType,
@@ -133,7 +138,11 @@ 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
compare_values_by_handle> data_;
};
@@ -187,7 +196,7 @@ class tree_iterator:
friend class boost::iterator_core_access;
typedef typename boost::mpl::if_c< ordered_iterator,
typedef typename boost::conditional< ordered_iterator,
ordered_tree_iterator_storage<ValueType, const Node*, Alloc, ValueCompare, ValueExtractor>,
unordered_tree_iterator_storage<const Node*, Alloc, ValueCompare>
>::type

View File

@@ -20,6 +20,7 @@
#include <boost/heap/detail/heap_node.hpp>
#include <boost/heap/detail/stable_heap.hpp>
#include <boost/heap/detail/tree_iterator.hpp>
#include <boost/type_traits/integral_constant.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
@@ -50,7 +51,7 @@ struct make_fibonacci_heap_base
{
static const bool constant_time_size = parameter::binding<Parspec,
tag::constant_time_size,
boost::mpl::true_
boost::true_type
>::type::value;
typedef typename detail::make_heap_base<T, Parspec, constant_time_size>::type base_type;
@@ -58,7 +59,11 @@ 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
struct type:
base_type,
@@ -154,8 +159,14 @@ 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 detail::heap_node_list node_list_type;
typedef typename node_list_type::iterator node_list_iterator;
@@ -201,6 +212,9 @@ 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;
@@ -299,7 +313,12 @@ 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
}
/// \copydoc boost::heap::priority_queue::clear
@@ -347,9 +366,14 @@ 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
roots.push_front(*n);
if (!top_element || super_t::operator()(top_element->value, n->value))
@@ -371,9 +395,14 @@ 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
roots.push_front(*n);
if (!top_element || super_t::operator()(top_element->value, n->value))
@@ -741,8 +770,14 @@ 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
size_holder::decrement();
if (!empty())

View File

@@ -9,8 +9,11 @@
#ifndef BOOST_HEAP_MERGE_HPP
#define BOOST_HEAP_MERGE_HPP
#include <algorithm>
#include <boost/concept/assert.hpp>
#include <boost/heap/heap_concepts.hpp>
#include <boost/type_traits/conditional.hpp>
#include <boost/type_traits/is_same.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
@@ -39,7 +42,7 @@ struct heap_merge_emulate
}
};
typedef typename boost::mpl::if_c<Heap1::has_reserve,
typedef typename boost::conditional<Heap1::has_reserve,
reserver,
dummy_reserver>::type space_reserver;
@@ -83,7 +86,7 @@ template <typename Heap>
struct heap_merge_same
{
static const bool is_mergable = Heap::is_mergable;
typedef typename boost::mpl::if_c<is_mergable,
typedef typename boost::conditional<is_mergable,
heap_merge_same_mergable<Heap>,
heap_merge_emulate<Heap, Heap>
>::type heap_merger;
@@ -115,7 +118,7 @@ void heap_merge(Heap1 & lhs, Heap2 & rhs)
const bool same_heaps = boost::is_same<Heap1, Heap2>::value;
typedef typename boost::mpl::if_c<same_heaps,
typedef typename boost::conditional<same_heaps,
detail::heap_merge_same<Heap1>,
detail::heap_merge_emulate<Heap1, Heap2>
>::type heap_merger;

View File

@@ -20,6 +20,7 @@
#include <boost/heap/policies.hpp>
#include <boost/heap/detail/stable_heap.hpp>
#include <boost/heap/detail/tree_iterator.hpp>
#include <boost/type_traits/integral_constant.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
@@ -50,7 +51,7 @@ struct make_pairing_heap_base
{
static const bool constant_time_size = parameter::binding<Parspec,
tag::constant_time_size,
boost::mpl::true_
boost::true_type
>::type::value;
typedef typename detail::make_heap_base<T, Parspec, constant_time_size>::type base_type;
typedef typename detail::make_heap_base<T, Parspec, constant_time_size>::allocator_argument allocator_argument;
@@ -58,7 +59,11 @@ 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
struct type:
base_type,
@@ -158,8 +163,14 @@ 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 detail::heap_node_list node_list_type;
typedef typename node_list_type::iterator node_list_iterator;
@@ -213,6 +224,9 @@ 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;
@@ -302,7 +316,12 @@ 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
}
/// \copydoc boost::heap::priority_queue::clear
@@ -312,8 +331,14 @@ 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
root = NULL;
size_holder::set_size(0);
}
@@ -354,10 +379,14 @@ 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
merge_node(n);
return handle_type(n);
}
@@ -378,10 +407,14 @@ 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
merge_node(n);
return handle_type(n);
}
@@ -527,8 +560,14 @@ 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
}
/// \copydoc boost::heap::priority_queue::begin

View File

@@ -10,10 +10,10 @@
#define BOOST_HEAP_POLICIES_HPP
#include <boost/parameter.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/void.hpp>
#include <boost/concept_check.hpp>
#include <boost/type_traits/conditional.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/type_traits/is_void.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
@@ -30,14 +30,14 @@ namespace tag { struct stable; }
template <bool T>
struct stable:
boost::parameter::template_keyword<tag::stable, boost::mpl::bool_<T> >
boost::parameter::template_keyword<tag::stable, boost::integral_constant<bool, T> >
{};
namespace tag { struct mutable_; }
template <bool T>
struct mutable_:
boost::parameter::template_keyword<tag::mutable_, boost::mpl::bool_<T> >
boost::parameter::template_keyword<tag::mutable_, boost::integral_constant<bool, T> >
{};
@@ -45,41 +45,39 @@ namespace tag { struct constant_time_size; }
template <bool T>
struct constant_time_size:
boost::parameter::template_keyword<tag::constant_time_size, boost::mpl::bool_<T> >
boost::parameter::template_keyword<tag::constant_time_size, boost::integral_constant<bool, T> >
{};
namespace tag { struct store_parent_pointer; }
template <bool T>
struct store_parent_pointer:
boost::parameter::template_keyword<tag::store_parent_pointer, boost::mpl::bool_<T> >
boost::parameter::template_keyword<tag::store_parent_pointer, boost::integral_constant<bool, T> >
{};
namespace tag { struct arity; }
template <unsigned int T>
struct arity:
boost::parameter::template_keyword<tag::arity, boost::mpl::int_<T> >
boost::parameter::template_keyword<tag::arity, boost::integral_constant<int, T> >
{};
namespace tag { struct objects_per_page; }
template <unsigned int T>
struct objects_per_page:
boost::parameter::template_keyword<tag::objects_per_page, boost::mpl::int_<T> >
boost::parameter::template_keyword<tag::objects_per_page, boost::integral_constant<int, T> >
{};
BOOST_PARAMETER_TEMPLATE_KEYWORD(stability_counter_type)
namespace detail {
namespace mpl = boost::mpl;
template <typename bound_args, typename tag_type>
struct has_arg
{
typedef typename boost::parameter::binding<bound_args, tag_type, mpl::void_>::type type;
static const bool value = mpl::is_not_void_<type>::type::value;
typedef typename boost::parameter::binding<bound_args, tag_type, void>::type type;
static const bool value = !boost::is_void<type>::value;
};
template <typename bound_args>
@@ -87,9 +85,9 @@ struct extract_stable
{
static const bool has_stable = has_arg<bound_args, tag::stable>::value;
typedef typename mpl::if_c<has_stable,
typedef typename boost::conditional<has_stable,
typename has_arg<bound_args, tag::stable>::type,
mpl::bool_<false>
boost::false_type
>::type stable_t;
static const bool value = stable_t::value;
@@ -100,9 +98,9 @@ struct extract_mutable
{
static const bool has_mutable = has_arg<bound_args, tag::mutable_>::value;
typedef typename mpl::if_c<has_mutable,
typedef typename boost::conditional<has_mutable,
typename has_arg<bound_args, tag::mutable_>::type,
mpl::bool_<false>
boost::false_type
>::type mutable_t;
static const bool value = mutable_t::value;

View File

@@ -67,7 +67,11 @@ 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 std::vector<internal_type, internal_type_allocator> container_type;
template <typename Heap1, typename Heap2>
@@ -83,6 +87,9 @@ 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
@@ -92,6 +99,9 @@ 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;

View File

@@ -20,6 +20,7 @@
#include <boost/heap/detail/heap_node.hpp>
#include <boost/heap/detail/stable_heap.hpp>
#include <boost/heap/detail/tree_iterator.hpp>
#include <boost/type_traits/integral_constant.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
@@ -178,7 +179,7 @@ struct make_skew_heap_base
{
static const bool constant_time_size = parameter::binding<BoundArgs,
tag::constant_time_size,
boost::mpl::true_
boost::true_type
>::type::value;
typedef typename make_heap_base<T, BoundArgs, constant_time_size>::type base_type;
@@ -188,11 +189,15 @@ struct make_skew_heap_base
static const bool is_mutable = extract_mutable<BoundArgs>::value;
static const bool store_parent_pointer = parameter::binding<BoundArgs,
tag::store_parent_pointer,
boost::mpl::false_>::type::value || is_mutable;
boost::false_type>::type::value || is_mutable;
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
struct type:
base_type,
@@ -290,15 +295,21 @@ 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 detail::value_extractor<value_type, internal_type, super_t> value_extractor;
typedef boost::array<node_pointer, 2> child_list_type;
typedef typename child_list_type::iterator child_list_iterator;
typedef typename boost::mpl::if_c<false,
typedef typename boost::conditional<false,
detail::recursive_tree_iterator<node,
child_list_iterator,
const value_type,
@@ -345,6 +356,9 @@ 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;
@@ -362,7 +376,7 @@ public:
static const bool has_reserve = false;
static const bool is_mutable = detail::extract_mutable<bound_args>::value;
typedef typename mpl::if_c<is_mutable, typename implementation_defined::handle_type, void*>::type handle_type;
typedef typename boost::conditional<is_mutable, typename implementation_defined::handle_type, void*>::type handle_type;
/// \copydoc boost::heap::priority_queue::priority_queue(value_compare const &)
explicit skew_heap(value_compare const & cmp = value_compare()):
@@ -420,9 +434,9 @@ public:
* \b Complexity: Logarithmic (amortized).
*
* */
typename mpl::if_c<is_mutable, handle_type, void>::type push(value_type const & v)
typename boost::conditional<is_mutable, handle_type, void>::type push(value_type const & v)
{
typedef typename mpl::if_c<is_mutable, push_handle, push_void>::type push_helper;
typedef typename boost::conditional<is_mutable, push_handle, push_void>::type push_helper;
return push_helper::push(this, v);
}
@@ -434,9 +448,9 @@ public:
*
* */
template <typename... Args>
typename mpl::if_c<is_mutable, handle_type, void>::type emplace(Args&&... args)
typename boost::conditional<is_mutable, handle_type, void>::type emplace(Args&&... args)
{
typedef typename mpl::if_c<is_mutable, push_handle, push_void>::type push_helper;
typedef typename boost::conditional<is_mutable, push_handle, push_void>::type push_helper;
return push_helper::emplace(this, std::forward<Args>(args)...);
}
#endif
@@ -462,7 +476,12 @@ 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
}
/// \copydoc boost::heap::priority_queue::clear
@@ -472,9 +491,14 @@ 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
root = NULL;
size_holder::set_size(0);
}
@@ -521,7 +545,14 @@ 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
sanity_check();
}
@@ -642,8 +673,14 @@ 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
}
/**
@@ -794,9 +831,14 @@ private:
{
size_holder::increment();
node_pointer n = super_t::allocate(1);
#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
merge_node(n);
return n;
}
@@ -807,9 +849,14 @@ private:
{
size_holder::increment();
node_pointer n = super_t::allocate(1);
#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
merge_node(n);
return n;
}
@@ -836,9 +883,14 @@ private:
if (rhs.empty())
return;
allocator_type& alloc = *this;
#ifdef BOOST_NO_CXX11_ALLOCATOR
root = allocator_type::allocate(1);
new(root) node(*rhs.root, static_cast<allocator_type&>(*this), NULL);
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)