update boost on linux
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user