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