summaryrefslogtreecommitdiff
path: root/boost/heap
diff options
context:
space:
mode:
Diffstat (limited to 'boost/heap')
-rw-r--r--boost/heap/binomial_heap.hpp4
-rw-r--r--boost/heap/detail/stable_heap.hpp83
-rw-r--r--boost/heap/detail/tree_iterator.hpp6
-rw-r--r--boost/heap/priority_queue.hpp18
4 files changed, 56 insertions, 55 deletions
diff --git a/boost/heap/binomial_heap.hpp b/boost/heap/binomial_heap.hpp
index 01ccf3fc8d..a6f75c3aee 100644
--- a/boost/heap/binomial_heap.hpp
+++ b/boost/heap/binomial_heap.hpp
@@ -516,8 +516,7 @@ public:
siftdown(n);
- if (n == top_element)
- update_top_element();
+ update_top_element();
}
/**
@@ -792,7 +791,6 @@ private:
trees.insert(it, *n);
}
n->add_child(parent);
- BOOST_HEAP_ASSERT(parent->child_count() == n->child_count());
}
}
diff --git a/boost/heap/detail/stable_heap.hpp b/boost/heap/detail/stable_heap.hpp
index 768c0bf7af..29efc48b50 100644
--- a/boost/heap/detail/stable_heap.hpp
+++ b/boost/heap/detail/stable_heap.hpp
@@ -20,6 +20,9 @@
#include <boost/heap/policies.hpp>
#include <boost/heap/heap_merge.hpp>
+#include <boost/type_traits/is_nothrow_move_constructible.hpp>
+#include <boost/type_traits/is_nothrow_move_assignable.hpp>
+
namespace boost {
namespace heap {
namespace detail {
@@ -30,54 +33,54 @@ struct size_holder
static const bool constant_time_size = ConstantSize;
typedef SizeType size_type;
- size_holder(void):
+ size_holder(void) BOOST_NOEXCEPT:
size_(0)
{}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
- size_holder(size_holder && rhs):
+ size_holder(size_holder && rhs) BOOST_NOEXCEPT:
size_(rhs.size_)
{
rhs.size_ = 0;
}
- size_holder(size_holder const & rhs):
+ size_holder(size_holder const & rhs) BOOST_NOEXCEPT:
size_(rhs.size_)
{}
- size_holder & operator=(size_holder && rhs)
+ size_holder & operator=(size_holder && rhs) BOOST_NOEXCEPT
{
size_ = rhs.size_;
rhs.size_ = 0;
return *this;
}
- size_holder & operator=(size_holder const & rhs)
+ size_holder & operator=(size_holder const & rhs) BOOST_NOEXCEPT
{
size_ = rhs.size_;
return *this;
}
#endif
- SizeType get_size() const
+ SizeType get_size() const BOOST_NOEXCEPT
{ return size_; }
- void set_size(SizeType size)
+ void set_size(SizeType size) BOOST_NOEXCEPT
{ size_ = size; }
- void decrement()
+ void decrement() BOOST_NOEXCEPT
{ --size_; }
- void increment()
+ void increment() BOOST_NOEXCEPT
{ ++size_; }
- void add(SizeType value)
+ void add(SizeType value) BOOST_NOEXCEPT
{ size_ += value; }
- void sub(SizeType value)
+ void sub(SizeType value) BOOST_NOEXCEPT
{ size_ -= value; }
- void swap(size_holder & rhs)
+ void swap(size_holder & rhs) BOOST_NOEXCEPT
{ std::swap(size_, rhs.size_); }
SizeType size_;
@@ -89,46 +92,46 @@ struct size_holder<false, SizeType>
static const bool constant_time_size = false;
typedef SizeType size_type;
- size_holder(void)
+ size_holder(void) BOOST_NOEXCEPT
{}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
- size_holder(size_holder && rhs)
+ size_holder(size_holder && rhs) BOOST_NOEXCEPT
{}
- size_holder(size_holder const & rhs)
+ size_holder(size_holder const & rhs) BOOST_NOEXCEPT
{}
- size_holder & operator=(size_holder && rhs)
+ size_holder & operator=(size_holder && rhs) BOOST_NOEXCEPT
{
return *this;
}
- size_holder & operator=(size_holder const & rhs)
+ size_holder & operator=(size_holder const & rhs) BOOST_NOEXCEPT
{
return *this;
}
#endif
- size_type get_size() const
+ size_type get_size() const BOOST_NOEXCEPT
{ return 0; }
- void set_size(size_type)
+ void set_size(size_type) BOOST_NOEXCEPT
{}
- void decrement()
+ void decrement() BOOST_NOEXCEPT
{}
- void increment()
+ void increment() BOOST_NOEXCEPT
{}
- void add(SizeType value)
+ void add(SizeType /*value*/) BOOST_NOEXCEPT
{}
- void sub(SizeType value)
+ void sub(SizeType /*value*/) BOOST_NOEXCEPT
{}
- void swap(size_holder & rhs)
+ void swap(size_holder & /*rhs*/) BOOST_NOEXCEPT
{}
};
@@ -167,7 +170,7 @@ struct heap_base:
{}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
- heap_base(heap_base && rhs):
+ 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
@@ -185,7 +188,7 @@ struct heap_base:
size_holder_type(static_cast<size_holder_type const &>(rhs))
{}
- heap_base & operator=(heap_base && rhs)
+ heap_base & operator=(heap_base && rhs) BOOST_NOEXCEPT_IF(boost::is_nothrow_move_assignable<Cmp>::value)
{
value_comp_ref().operator=(std::move(rhs.value_comp_ref()));
size_holder_type::operator=(std::move(static_cast<size_holder_type&>(rhs)));
@@ -225,17 +228,17 @@ struct heap_base:
}
#endif
- static T & get_value(internal_type & val)
+ static T & get_value(internal_type & val) BOOST_NOEXCEPT
{
return val;
}
- static T const & get_value(internal_type const & val)
+ static T const & get_value(internal_type const & val) BOOST_NOEXCEPT
{
return val;
}
- Cmp const & value_comp(void) const
+ Cmp const & value_comp(void) const BOOST_NOEXCEPT
{
#ifndef BOOST_MSVC
return *this;
@@ -244,23 +247,23 @@ struct heap_base:
#endif
}
- Cmp const & get_internal_cmp(void) const
+ Cmp const & get_internal_cmp(void) const BOOST_NOEXCEPT
{
return value_comp();
}
- void swap(heap_base & rhs)
+ void swap(heap_base & rhs) BOOST_NOEXCEPT_IF(boost::is_nothrow_move_constructible<Cmp>::value && boost::is_nothrow_move_assignable<Cmp>::value)
{
std::swap(value_comp_ref(), rhs.value_comp_ref());
size_holder<constant_time_size, size_t>::swap(rhs);
}
- stability_counter_type get_stability_count(void) const
+ stability_counter_type get_stability_count(void) const BOOST_NOEXCEPT
{
return 0;
}
- void set_stability_count(stability_counter_type)
+ void set_stability_count(stability_counter_type) BOOST_NOEXCEPT
{}
template <typename Heap1, typename Heap2>
@@ -326,7 +329,7 @@ struct heap_base<T, Cmp, constant_time_size, StabilityCounterType, true>:
{}
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
- heap_base(heap_base && rhs):
+ 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
@@ -346,7 +349,7 @@ struct heap_base<T, Cmp, constant_time_size, StabilityCounterType, true>:
size_holder_type(static_cast<size_holder_type const &>(rhs)), counter_(rhs.counter_)
{}
- heap_base & operator=(heap_base && rhs)
+ heap_base & operator=(heap_base && rhs) BOOST_NOEXCEPT_IF(boost::is_nothrow_move_assignable<Cmp>::value)
{
value_comp_ref().operator=(std::move(rhs.value_comp_ref()));
size_holder_type::operator=(std::move(static_cast<size_holder_type&>(rhs)));
@@ -395,17 +398,17 @@ struct heap_base<T, Cmp, constant_time_size, StabilityCounterType, true>:
}
#endif
- static T & get_value(internal_type & val)
+ static T & get_value(internal_type & val) BOOST_NOEXCEPT
{
return val.first;
}
- static T const & get_value(internal_type const & val)
+ static T const & get_value(internal_type const & val) BOOST_NOEXCEPT
{
return val.first;
}
- Cmp const & value_comp(void) const
+ Cmp const & value_comp(void) const BOOST_NOEXCEPT
{
#ifndef BOOST_MSVC
return *this;
@@ -438,7 +441,7 @@ struct heap_base<T, Cmp, constant_time_size, StabilityCounterType, true>:
return internal_compare(value_comp());
}
- void swap(heap_base & rhs)
+ void swap(heap_base & rhs) BOOST_NOEXCEPT_IF(boost::is_nothrow_move_constructible<Cmp>::value && boost::is_nothrow_move_assignable<Cmp>::value)
{
#ifndef BOOST_MSVC
std::swap(static_cast<Cmp&>(*this), static_cast<Cmp&>(rhs));
@@ -463,7 +466,7 @@ struct heap_base<T, Cmp, constant_time_size, StabilityCounterType, true>:
friend struct heap_merge_emulate;
private:
- Cmp & value_comp_ref(void)
+ Cmp & value_comp_ref(void) BOOST_NOEXCEPT
{
#ifndef BOOST_MSVC
return *this;
diff --git a/boost/heap/detail/tree_iterator.hpp b/boost/heap/detail/tree_iterator.hpp
index 2bc05ea1ab..c7ab2e80b3 100644
--- a/boost/heap/detail/tree_iterator.hpp
+++ b/boost/heap/detail/tree_iterator.hpp
@@ -23,10 +23,10 @@ namespace detail {
template<typename type>
struct identity
{
- type& operator()(type& x) const
+ type& operator()(type& x) const BOOST_NOEXCEPT
{ return x; }
- const type& operator()(const type& x) const
+ const type& operator()(const type& x) const BOOST_NOEXCEPT
{ return x; }
};
@@ -127,7 +127,7 @@ struct ordered_tree_iterator_storage:
return data_.top();
}
- bool empty(void) const
+ bool empty(void) const BOOST_NOEXCEPT
{
return data_.empty();
}
diff --git a/boost/heap/priority_queue.hpp b/boost/heap/priority_queue.hpp
index 45f2151739..fe2470dc22 100644
--- a/boost/heap/priority_queue.hpp
+++ b/boost/heap/priority_queue.hpp
@@ -136,7 +136,7 @@ public:
*
* \b Note: Only available, if BOOST_NO_CXX11_RVALUE_REFERENCES is not defined
* */
- priority_queue(priority_queue && rhs):
+ priority_queue(priority_queue && rhs) BOOST_NOEXCEPT_IF(boost::is_nothrow_move_constructible<super_t>::value):
super_t(std::move(rhs)), q_(std::move(rhs.q_))
{}
@@ -147,7 +147,7 @@ public:
*
* \b Note: Only available, if BOOST_NO_CXX11_RVALUE_REFERENCES is not defined
* */
- priority_queue & operator=(priority_queue && rhs)
+ priority_queue & operator=(priority_queue && rhs) BOOST_NOEXCEPT_IF(boost::is_nothrow_move_assignable<super_t>::value)
{
super_t::operator=(std::move(rhs));
q_ = std::move(rhs.q_);
@@ -174,7 +174,7 @@ public:
* \b Complexity: Constant.
*
* */
- bool empty(void) const
+ bool empty(void) const BOOST_NOEXCEPT
{
return q_.empty();
}
@@ -185,7 +185,7 @@ public:
* \b Complexity: Constant.
*
* */
- size_type size(void) const
+ size_type size(void) const BOOST_NOEXCEPT
{
return q_.size();
}
@@ -196,7 +196,7 @@ public:
* \b Complexity: Constant.
*
* */
- size_type max_size(void) const
+ size_type max_size(void) const BOOST_NOEXCEPT
{
return q_.max_size();
}
@@ -207,7 +207,7 @@ public:
* \b Complexity: Linear.
*
* */
- void clear(void)
+ void clear(void) BOOST_NOEXCEPT
{
q_.clear();
}
@@ -281,7 +281,7 @@ public:
* \b Complexity: Constant.
*
* */
- void swap(priority_queue & rhs)
+ void swap(priority_queue & rhs) BOOST_NOEXCEPT_IF(boost::is_nothrow_move_constructible<super_t>::value && boost::is_nothrow_move_assignable<super_t>::value)
{
super_t::swap(rhs);
q_.swap(rhs.q_);
@@ -293,7 +293,7 @@ public:
* \b Complexity: Constant.
*
* */
- iterator begin(void) const
+ iterator begin(void) const BOOST_NOEXCEPT
{
return iterator(q_.begin());
}
@@ -304,7 +304,7 @@ public:
* \b Complexity: Constant.
*
* */
- iterator end(void) const
+ iterator end(void) const BOOST_NOEXCEPT
{
return iterator(q_.end());
}