summaryrefslogtreecommitdiff
path: root/boost/heap/d_ary_heap.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/heap/d_ary_heap.hpp')
-rw-r--r--boost/heap/d_ary_heap.hpp35
1 files changed, 17 insertions, 18 deletions
diff --git a/boost/heap/d_ary_heap.hpp b/boost/heap/d_ary_heap.hpp
index 2bfa187595..b3194be8a7 100644
--- a/boost/heap/d_ary_heap.hpp
+++ b/boost/heap/d_ary_heap.hpp
@@ -10,6 +10,7 @@
#define BOOST_HEAP_D_ARY_HEAP_HPP
#include <algorithm>
+#include <utility>
#include <vector>
#include <boost/assert.hpp>
@@ -20,6 +21,11 @@
#include <boost/heap/detail/stable_heap.hpp>
#include <boost/heap/detail/mutable_heap.hpp>
+#ifdef BOOST_HAS_PRAGMA_ONCE
+#pragma once
+#endif
+
+
#ifndef BOOST_DOXYGEN_INVOKED
#ifdef BOOST_HEAP_SANITYCHECKS
#define BOOST_HEAP_ASSERT BOOST_ASSERT
@@ -32,16 +38,11 @@ namespace boost {
namespace heap {
namespace detail {
-template <typename T>
struct nop_index_updater
{
- void operator()(T &, std::size_t) const
+ template <typename T>
+ static void run(T &, std::size_t)
{}
-
- template <typename U>
- struct rebind {
- typedef nop_index_updater<U> other;
- };
};
typedef parameter::parameters<boost::parameter::required<tag::arity>,
@@ -69,7 +70,7 @@ class d_ary_heap:
typedef std::vector<internal_type, internal_type_allocator> container_type;
typedef typename container_type::const_iterator container_iterator;
- typedef typename IndexUpdater::template rebind<internal_type>::other index_updater;
+ typedef IndexUpdater index_updater;
container_type q_;
@@ -159,7 +160,7 @@ public:
super_t(rhs), q_(rhs.q_)
{}
-#ifdef BOOST_HAS_RVALUE_REFS
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
d_ary_heap(d_ary_heap && rhs):
super_t(std::move(rhs)), q_(std::move(rhs.q_))
{}
@@ -217,7 +218,7 @@ public:
siftup(q_.size() - 1);
}
-#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES)
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <class... Args>
void emplace(Args&&... args)
{
@@ -279,7 +280,7 @@ private:
void reset_index(size_type index, size_type new_index)
{
BOOST_HEAP_ASSERT(index < q_.size());
- index_updater()(q_[index], new_index);
+ index_updater::run(q_[index], new_index);
}
void siftdown(size_type index)
@@ -352,10 +353,8 @@ private:
size_type last_child_index(size_type index) const
{
- typedef typename container_type::const_iterator container_iterator;
const size_t first_index = first_child_index(index);
-
- const size_type last_index = std::min(first_index + D - 1, size() - 1);
+ const size_type last_index = (std::min)(first_index + D - 1, size() - 1);
return last_index;
}
@@ -423,8 +422,8 @@ struct select_dary_heap
static const bool is_mutable = extract_mutable<BoundArgs>::value;
typedef typename mpl::if_c< is_mutable,
- priority_queue_mutable_wrapper<d_ary_heap<T, BoundArgs, nop_index_updater<T> > >,
- d_ary_heap<T, BoundArgs, nop_index_updater<T> >
+ priority_queue_mutable_wrapper<d_ary_heap<T, BoundArgs, nop_index_updater > >,
+ d_ary_heap<T, BoundArgs, nop_index_updater >
>::type type;
};
@@ -528,7 +527,7 @@ public:
super_t(rhs)
{}
-#ifdef BOOST_HAS_RVALUE_REFS
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
/// \copydoc boost::heap::priority_queue::priority_queue(priority_queue &&)
d_ary_heap(d_ary_heap && rhs):
super_t(std::move(rhs))
@@ -591,7 +590,7 @@ public:
return super_t::push(v);
}
-#if defined(BOOST_HAS_RVALUE_REFS) && !defined(BOOST_NO_VARIADIC_TEMPLATES)
+#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)