#include <boost/intrusive/detail/simple_disposers.hpp>
#include <boost/intrusive/detail/size_holder.hpp>
#include <boost/intrusive/detail/algorithm.hpp>
+#include <boost/intrusive/detail/value_functors.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/static_assert.hpp>
-#include <boost/intrusive/detail/minimal_less_equal_header.hpp>//std::less
#include <cstddef> //std::size_t
-#include <boost/intrusive/detail/minimal_pair_header.hpp> //std::pair
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
const_node_ptr get_last_node() const
{ return this->get_last_node(detail::bool_<cache_last>()); }
- void set_last_node(const node_ptr &n)
+ void set_last_node(node_ptr n)
{ return this->set_last_node(n, detail::bool_<cache_last>()); }
static node_ptr get_last_node(detail::bool_<false>)
return node_ptr();
}
- static void set_last_node(const node_ptr &, detail::bool_<false>)
+ static void set_last_node(node_ptr , detail::bool_<false>)
{
//This function shall not be used if cache_last is not true
BOOST_INTRUSIVE_INVARIANT_ASSERT(cache_last);
const_node_ptr get_last_node(detail::bool_<true>) const
{ return const_node_ptr(data_.root_plus_size_.last_); }
- void set_last_node(const node_ptr & n, detail::bool_<true>)
+ void set_last_node(node_ptr n, detail::bool_<true>)
{ data_.root_plus_size_.last_ = n; }
void set_default_constructed_state()
{
node_algorithms::init_header(this->get_root_node());
this->priv_size_traits().set_size(size_type(0));
- if(cache_last){
+ BOOST_IF_CONSTEXPR(cache_last){
this->set_last_node(this->get_root_node());
}
}
//! list. Iterators of this list and all the references are not invalidated.
//!
//! <b>Warning</b>: Experimental function, don't use it!
- slist_impl( const node_ptr & f, const node_ptr & before_l
+ slist_impl( node_ptr f, node_ptr before_l
, size_type n, const value_traits &v_traits = value_traits())
: data_(v_traits)
{
if(n){
this->priv_size_traits().set_size(n);
- if(cache_last){
+ BOOST_IF_CONSTEXPR(cache_last){
this->set_last_node(before_l);
}
node_traits::set_next(this->get_root_node(), f);
//! it's a safe-mode or auto-unlink value. Otherwise constant.
~slist_impl()
{
- if(is_safe_autounlink<ValueTraits::link_mode>::value){
+ BOOST_IF_CONSTEXPR(is_safe_autounlink<ValueTraits::link_mode>::value){
this->clear();
node_algorithms::init(this->get_root_node());
}
//! if it's a safe-mode or auto-unlink value_type. Constant time otherwise.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the erased elements.
- void clear()
+ void clear() BOOST_NOEXCEPT
{
- if(safemode_or_autounlink){
+ BOOST_IF_CONSTEXPR(safemode_or_autounlink){
this->clear_and_dispose(detail::null_disposer());
}
else{
//!
//! <b>Note</b>: Invalidates the iterators to the erased elements.
template <class Disposer>
- void clear_and_dispose(Disposer disposer)
+ void clear_and_dispose(Disposer disposer) BOOST_NOEXCEPT
{
const_iterator it(this->begin()), itend(this->end());
while(it != itend){
node_ptr to_erase(it.pointed_node());
++it;
- if(safemode_or_autounlink)
+ BOOST_IF_CONSTEXPR(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(priv_value_traits().to_value_ptr(to_erase));
}
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
- void push_front(reference value)
+ void push_front(reference value) BOOST_NOEXCEPT
{
node_ptr to_insert = priv_value_traits().to_node_ptr(value);
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::inited(to_insert));
- if(cache_last){
+ BOOST_IF_CONSTEXPR(cache_last){
if(this->empty()){
this->set_last_node(to_insert);
}
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! This function is only available is cache_last<> is true.
- void push_back(reference value)
+ void push_back(reference value) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT((cache_last));
node_ptr n = priv_value_traits().to_node_ptr(value);
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::inited(n));
node_algorithms::link_after(this->get_last_node(), n);
- if(cache_last){
+ BOOST_IF_CONSTEXPR(cache_last){
this->set_last_node(n);
}
this->priv_size_traits().increment();
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the erased element.
- void pop_front()
+ void pop_front() BOOST_NOEXCEPT
{ return this->pop_front_and_dispose(detail::null_disposer()); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer>
- void pop_front_and_dispose(Disposer disposer)
+ void pop_front_and_dispose(Disposer disposer) BOOST_NOEXCEPT
{
node_ptr to_erase = node_traits::get_next(this->get_root_node());
node_algorithms::unlink_after(this->get_root_node());
this->priv_size_traits().decrement();
- if(safemode_or_autounlink)
+ BOOST_IF_CONSTEXPR(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(priv_value_traits().to_value_ptr(to_erase));
- if(cache_last){
+ BOOST_IF_CONSTEXPR(cache_last){
if(this->empty()){
this->set_last_node(this->get_root_node());
}
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- reference front()
+ BOOST_INTRUSIVE_FORCEINLINE reference front() BOOST_NOEXCEPT
{ return *this->priv_value_traits().to_value_ptr(node_traits::get_next(this->get_root_node())); }
//! <b>Effects</b>: Returns a const_reference to the first element of the list.
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- const_reference front() const
+ BOOST_INTRUSIVE_FORCEINLINE const_reference front() const BOOST_NOEXCEPT
{ return *this->priv_value_traits().to_value_ptr(detail::uncast(node_traits::get_next(this->get_root_node()))); }
//! <b>Effects</b>: Returns a reference to the last element of the list.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! This function is only available is cache_last<> is true.
- reference back()
+ reference back() BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT((cache_last));
return *this->priv_value_traits().to_value_ptr(this->get_last_node());
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
//! This function is only available is cache_last<> is true.
- const_reference back() const
+ BOOST_INTRUSIVE_FORCEINLINE const_reference back() const BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT((cache_last));
return *this->priv_value_traits().to_value_ptr(this->get_last_node());
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- iterator begin()
+ BOOST_INTRUSIVE_FORCEINLINE iterator begin() BOOST_NOEXCEPT
{ return iterator (node_traits::get_next(this->get_root_node()), this->priv_value_traits_ptr()); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- const_iterator begin() const
+ BOOST_INTRUSIVE_FORCEINLINE const_iterator begin() const BOOST_NOEXCEPT
{ return const_iterator (node_traits::get_next(this->get_root_node()), this->priv_value_traits_ptr()); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the list.
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- const_iterator cbegin() const
+ BOOST_INTRUSIVE_FORCEINLINE const_iterator cbegin() const BOOST_NOEXCEPT
{ return const_iterator(node_traits::get_next(this->get_root_node()), this->priv_value_traits_ptr()); }
//! <b>Effects</b>: Returns an iterator to the end of the list.
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- iterator end()
+ BOOST_INTRUSIVE_FORCEINLINE iterator end() BOOST_NOEXCEPT
{ return iterator(this->get_end_node(), this->priv_value_traits_ptr()); }
//! <b>Effects</b>: Returns a const_iterator to the end of the list.
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- const_iterator end() const
+ BOOST_INTRUSIVE_FORCEINLINE const_iterator end() const BOOST_NOEXCEPT
{ return const_iterator(detail::uncast(this->get_end_node()), this->priv_value_traits_ptr()); }
//! <b>Effects</b>: Returns a const_iterator to the end of the list.
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- const_iterator cend() const
+ BOOST_INTRUSIVE_FORCEINLINE const_iterator cend() const BOOST_NOEXCEPT
{ return this->end(); }
//! <b>Effects</b>: Returns an iterator that points to a position
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- iterator before_begin()
+ BOOST_INTRUSIVE_FORCEINLINE iterator before_begin() BOOST_NOEXCEPT
{ return iterator(this->get_root_node(), this->priv_value_traits_ptr()); }
//! <b>Effects</b>: Returns an iterator that points to a position
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- const_iterator before_begin() const
+ BOOST_INTRUSIVE_FORCEINLINE const_iterator before_begin() const BOOST_NOEXCEPT
{ return const_iterator(detail::uncast(this->get_root_node()), this->priv_value_traits_ptr()); }
//! <b>Effects</b>: Returns an iterator that points to a position
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- const_iterator cbefore_begin() const
+ BOOST_INTRUSIVE_FORCEINLINE const_iterator cbefore_begin() const BOOST_NOEXCEPT
{ return this->before_begin(); }
//! <b>Effects</b>: Returns an iterator to the last element contained in the list.
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: This function is present only if cached_last<> option is true.
- iterator last()
+ BOOST_INTRUSIVE_FORCEINLINE iterator last() BOOST_NOEXCEPT
{
//This function shall not be used if cache_last is not true
BOOST_INTRUSIVE_INVARIANT_ASSERT(cache_last);
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: This function is present only if cached_last<> option is true.
- const_iterator last() const
+ BOOST_INTRUSIVE_FORCEINLINE const_iterator last() const BOOST_NOEXCEPT
{
//This function shall not be used if cache_last is not true
BOOST_INTRUSIVE_INVARIANT_ASSERT(cache_last);
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: This function is present only if cached_last<> option is true.
- const_iterator clast() const
+ BOOST_INTRUSIVE_FORCEINLINE const_iterator clast() const BOOST_NOEXCEPT
{ return const_iterator(this->get_last_node(), this->priv_value_traits_ptr()); }
//! <b>Precondition</b>: end_iterator must be a valid end iterator
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- static slist_impl &container_from_end_iterator(iterator end_iterator)
+ BOOST_INTRUSIVE_FORCEINLINE static slist_impl &container_from_end_iterator(iterator end_iterator) BOOST_NOEXCEPT
{ return slist_impl::priv_container_from_end_iterator(end_iterator); }
//! <b>Precondition</b>: end_iterator must be a valid end const_iterator
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
- static const slist_impl &container_from_end_iterator(const_iterator end_iterator)
+ BOOST_INTRUSIVE_FORCEINLINE static const slist_impl &container_from_end_iterator(const_iterator end_iterator) BOOST_NOEXCEPT
{ return slist_impl::priv_container_from_end_iterator(end_iterator); }
//! <b>Effects</b>: Returns the number of the elements contained in the list.
//! if constant_time_size is false. Constant time otherwise.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
- size_type size() const
+ BOOST_INTRUSIVE_FORCEINLINE size_type size() const BOOST_NOEXCEPT
{
- if(constant_time_size)
+ BOOST_IF_CONSTEXPR(constant_time_size)
return this->priv_size_traits().get_size();
else
return node_algorithms::count(this->get_root_node()) - 1;
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
- bool empty() const
+ BOOST_INTRUSIVE_FORCEINLINE bool empty() const BOOST_NOEXCEPT
{ return node_algorithms::unique(this->get_root_node()); }
//! <b>Effects</b>: Swaps the elements of x and *this.
//! <b>Note</b>: Does not affect the validity of iterators and references.
void swap(slist_impl& other)
{
- if(cache_last){
+ BOOST_IF_CONSTEXPR(cache_last){
priv_swap_cache_last(this, &other);
}
else{
//! <b>Complexity</b>: Linear to the number of elements plus the number shifts.
//!
//! <b>Note</b>: Iterators Does not affect the validity of iterators and references.
- void shift_backwards(size_type n = 1)
+ void shift_backwards(size_type n = 1) BOOST_NOEXCEPT
{ this->priv_shift_backwards(n, detail::bool_<linear>()); }
//! <b>Effects</b>: Moves forward all the elements, so that the second
//! <b>Complexity</b>: Linear to the number of elements plus the number shifts.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
- void shift_forward(size_type n = 1)
+ void shift_forward(size_type n = 1) BOOST_NOEXCEPT
{ this->priv_shift_forward(n, detail::bool_<linear>()); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
- iterator insert_after(const_iterator prev_p, reference value)
+ iterator insert_after(const_iterator prev_p, reference value) BOOST_NOEXCEPT
{
node_ptr n = priv_value_traits().to_node_ptr(value);
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::inited(n));
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
template<class Iterator>
- void insert_after(const_iterator prev_p, Iterator f, Iterator l)
+ void insert_after(const_iterator prev_p, Iterator f, Iterator l) BOOST_NOEXCEPT
{
//Insert first nodes avoiding cache and size checks
size_type count = 0;
if(cache_last && (this->get_last_node() == prev_p.pointed_node())){
this->set_last_node(prev_n);
}
- if(constant_time_size){
+ BOOST_IF_CONSTEXPR(constant_time_size){
this->priv_size_traits().increase(count);
}
}
//! Constant-time if cache_last<> is true and p == end().
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
- iterator insert(const_iterator p, reference value)
+ iterator insert(const_iterator p, reference value) BOOST_NOEXCEPT
{ return this->insert_after(this->previous(p), value); }
//! <b>Requires</b>: Dereferencing iterator must yield
//!
//! <b>Note</b>: Does not affect the validity of iterators and references.
template<class Iterator>
- void insert(const_iterator p, Iterator b, Iterator e)
+ void insert(const_iterator p, Iterator b, Iterator e) BOOST_NOEXCEPT
{ return this->insert_after(this->previous(p), b, e); }
//! <b>Effects</b>: Erases the element after the element pointed by prev of
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
- iterator erase_after(const_iterator prev)
+ iterator erase_after(const_iterator prev) BOOST_NOEXCEPT
{ return this->erase_after_and_dispose(prev, detail::null_disposer()); }
//! <b>Effects</b>: Erases the range (before_f, l) from
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
- iterator erase_after(const_iterator before_f, const_iterator l)
+ iterator erase_after(const_iterator before_f, const_iterator l) BOOST_NOEXCEPT
{
- if(safemode_or_autounlink || constant_time_size){
+ BOOST_IF_CONSTEXPR(safemode_or_autounlink || constant_time_size){
return this->erase_after_and_dispose(before_f, l, detail::null_disposer());
}
else{
const node_ptr bfp = before_f.pointed_node();
const node_ptr lp = l.pointed_node();
- if(cache_last){
+ BOOST_IF_CONSTEXPR(cache_last){
if(lp == this->get_end_node()){
this->set_last_node(bfp);
}
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
- iterator erase_after(const_iterator before_f, const_iterator l, size_type n)
+ iterator erase_after(const_iterator before_f, const_iterator l, size_type n) BOOST_NOEXCEPT
{
BOOST_INTRUSIVE_INVARIANT_ASSERT(node_algorithms::distance((++const_iterator(before_f)).pointed_node(), l.pointed_node()) == n);
- if(safemode_or_autounlink){
+ (void)n;
+ BOOST_IF_CONSTEXPR(safemode_or_autounlink){
return this->erase_after(before_f, l);
}
else{
const node_ptr bfp = before_f.pointed_node();
const node_ptr lp = l.pointed_node();
- if(cache_last){
+ BOOST_IF_CONSTEXPR(cache_last){
if((lp == this->get_end_node())){
this->set_last_node(bfp);
}
}
node_algorithms::unlink_after(bfp, lp);
- if(constant_time_size){
+ BOOST_IF_CONSTEXPR(constant_time_size){
this->priv_size_traits().decrease(n);
}
return l.unconst();
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
- iterator erase(const_iterator i)
+ iterator erase(const_iterator i) BOOST_NOEXCEPT
{ return this->erase_after(this->previous(i)); }
//! <b>Requires</b>: f and l must be valid iterator to elements in *this.
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements.
- iterator erase(const_iterator f, const_iterator l)
+ iterator erase(const_iterator f, const_iterator l) BOOST_NOEXCEPT
{ return this->erase_after(this->previous(f), l); }
//! <b>Effects</b>: Erases the range [f, l) from
//!
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
- iterator erase(const_iterator f, const_iterator l, size_type n)
+ iterator erase(const_iterator f, const_iterator l, size_type n) BOOST_NOEXCEPT
{ return this->erase_after(this->previous(f), l, n); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer>
- iterator erase_after_and_dispose(const_iterator prev, Disposer disposer)
+ iterator erase_after_and_dispose(const_iterator prev, Disposer disposer) BOOST_NOEXCEPT
{
const_iterator it(prev);
++it;
if(cache_last && (to_erase == this->get_last_node())){
this->set_last_node(prev_n);
}
- if(safemode_or_autounlink)
+ BOOST_IF_CONSTEXPR(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(priv_value_traits().to_value_ptr(to_erase));
this->priv_size_traits().decrement();
/// @cond
- static iterator s_insert_after(const_iterator const prev_p, reference value)
+ static iterator s_insert_after(const_iterator const prev_p, reference value) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT(((!cache_last)&&(!constant_time_size)&&(!stateful_value_traits)));
node_ptr const n = value_traits::to_node_ptr(value);
}
template<class Disposer>
- static iterator s_erase_after_and_dispose(const_iterator prev, Disposer disposer)
+ static iterator s_erase_after_and_dispose(const_iterator prev, Disposer disposer) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT(((!cache_last)&&(!constant_time_size)&&(!stateful_value_traits)));
const_iterator it(prev);
++it;
node_ptr prev_n(prev.pointed_node());
node_algorithms::unlink_after(prev_n);
- if(safemode_or_autounlink)
+ BOOST_IF_CONSTEXPR(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(value_traits::to_value_ptr(to_erase));
return it.unconst();
}
template<class Disposer>
- static iterator s_erase_after_and_dispose(const_iterator before_f, const_iterator l, Disposer disposer)
+ static iterator s_erase_after_and_dispose(const_iterator before_f, const_iterator l, Disposer disposer) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT(((!cache_last)&&(!constant_time_size)&&(!stateful_value_traits)));
node_ptr bfp(before_f.pointed_node()), lp(l.pointed_node());
while(fp != lp){
node_ptr to_erase(fp);
fp = node_traits::get_next(fp);
- if(safemode_or_autounlink)
+ BOOST_IF_CONSTEXPR(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(value_traits::to_value_ptr(to_erase));
}
return l.unconst();
}
- static iterator s_erase_after(const_iterator prev)
+ static iterator s_erase_after(const_iterator prev) BOOST_NOEXCEPT
{ return s_erase_after_and_dispose(prev, detail::null_disposer()); }
/// @endcond
//!
//! <b>Note</b>: Invalidates the iterators to the erased element.
template<class Disposer>
- iterator erase_after_and_dispose(const_iterator before_f, const_iterator l, Disposer disposer)
+ iterator erase_after_and_dispose(const_iterator before_f, const_iterator l, Disposer disposer) BOOST_NOEXCEPT
{
node_ptr bfp(before_f.pointed_node()), lp(l.pointed_node());
node_ptr fp(node_traits::get_next(bfp));
while(fp != lp){
node_ptr to_erase(fp);
fp = node_traits::get_next(fp);
- if(safemode_or_autounlink)
+ BOOST_IF_CONSTEXPR(safemode_or_autounlink)
node_algorithms::init(to_erase);
disposer(priv_value_traits().to_value_ptr(to_erase));
this->priv_size_traits().decrement();
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased element.
template<class Disposer>
- iterator erase_and_dispose(const_iterator i, Disposer disposer)
+ iterator erase_and_dispose(const_iterator i, Disposer disposer) BOOST_NOEXCEPT
{ return this->erase_after_and_dispose(this->previous(i), disposer); }
#if !defined(BOOST_INTRUSIVE_DOXYGEN_INVOKED)
template<class Disposer>
- iterator erase_and_dispose(iterator i, Disposer disposer)
+ iterator erase_and_dispose(iterator i, Disposer disposer) BOOST_NOEXCEPT
{ return this->erase_and_dispose(const_iterator(i), disposer); }
#endif
//! <b>Note</b>: Invalidates the iterators (but not the references) to the
//! erased elements.
template<class Disposer>
- iterator erase_and_dispose(const_iterator f, const_iterator l, Disposer disposer)
+ iterator erase_and_dispose(const_iterator f, const_iterator l, Disposer disposer) BOOST_NOEXCEPT
{ return this->erase_after_and_dispose(this->previous(f), l, disposer); }
//! <b>Requires</b>: Dereferencing iterator must yield
//! assigned to the last spliced element or prev if x is empty.
//! This iterator can be used as new "prev" iterator for a new splice_after call.
//! that will splice new values after the previously spliced values.
- void splice_after(const_iterator prev, slist_impl &x, const_iterator *l = 0)
+ void splice_after(const_iterator prev, slist_impl &x, const_iterator *l = 0) BOOST_NOEXCEPT
{
if(x.empty()){
if(l) *l = prev;
const_iterator last_x(x.previous(x.end())); //constant time if cache_last is active
node_ptr prev_n(prev.pointed_node());
node_ptr last_x_n(last_x.pointed_node());
- if(cache_last){
+ BOOST_IF_CONSTEXPR(cache_last){
x.set_last_node(x.get_root_node());
if(node_traits::get_next(prev_n) == this->get_end_node()){
this->set_last_node(last_x_n);
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator prev_ele)
+ void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator prev_ele) BOOST_NOEXCEPT
{
const_iterator elem = prev_ele;
this->splice_after(prev_pos, x, prev_ele, ++elem, 1);
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator before_f, const_iterator before_l)
+ void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator before_f, const_iterator before_l) BOOST_NOEXCEPT
{
- if(constant_time_size)
+ BOOST_IF_CONSTEXPR(constant_time_size)
this->splice_after(prev_pos, x, before_f, before_l, node_algorithms::distance(before_f.pointed_node(), before_l.pointed_node()));
else
this->priv_splice_after
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator before_f, const_iterator before_l, size_type n)
+ void splice_after(const_iterator prev_pos, slist_impl &x, const_iterator before_f, const_iterator before_l, size_type n) BOOST_NOEXCEPT
{
BOOST_INTRUSIVE_INVARIANT_ASSERT(node_algorithms::distance(before_f.pointed_node(), before_l.pointed_node()) == n);
+ (void)n;
this->priv_splice_after
(prev_pos.pointed_node(), x, before_f.pointed_node(), before_l.pointed_node());
- if(constant_time_size){
+ BOOST_IF_CONSTEXPR(constant_time_size){
this->priv_size_traits().increase(n);
x.priv_size_traits().decrease(n);
}
//! assigned to the last spliced element or prev if x is empty.
//! This iterator can be used as new "prev" iterator for a new splice_after call.
//! that will splice new values after the previously spliced values.
- void splice(const_iterator it, slist_impl &x, const_iterator *l = 0)
+ void splice(const_iterator it, slist_impl &x, const_iterator *l = 0) BOOST_NOEXCEPT
{ this->splice_after(this->previous(it), x, l); }
//! <b>Requires</b>: it p must be a valid iterator of *this.
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- void splice(const_iterator pos, slist_impl &x, const_iterator elem)
+ void splice(const_iterator pos, slist_impl &x, const_iterator elem) BOOST_NOEXCEPT
{ return this->splice_after(this->previous(pos), x, x.previous(elem)); }
//! <b>Requires</b>: pos must be a dereferenceable iterator in *this
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- void splice(const_iterator pos, slist_impl &x, const_iterator f, const_iterator l)
+ void splice(const_iterator pos, slist_impl &x, const_iterator f, const_iterator l) BOOST_NOEXCEPT
{ return this->splice_after(this->previous(pos), x, x.previous(f), x.previous(l)); }
//! <b>Requires</b>: pos must be a dereferenceable iterator in *this
//!
//! <b>Note</b>: Iterators of values obtained from list x now point to elements of this
//! list. Iterators of this list and all the references are not invalidated.
- void splice(const_iterator pos, slist_impl &x, const_iterator f, const_iterator l, size_type n)
+ void splice(const_iterator pos, slist_impl &x, const_iterator f, const_iterator l, size_type n) BOOST_NOEXCEPT
{ return this->splice_after(this->previous(pos), x, x.previous(f), x.previous(l), n); }
- //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
+ //! <b>Effects</b>: This function sorts the list *this according to operator<.
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
//!
//! <b>Throws</b>: If value_traits::node_traits::node
BOOST_INTRUSIVE_INVARIANT_ASSERT(counter[i].empty());
const_iterator last_element(carry.previous(last_inserted, carry.end()));
- if(constant_time_size){
+ BOOST_IF_CONSTEXPR(constant_time_size){
counter[i].splice_after( counter[i].cbefore_begin(), carry
, carry.cbefore_begin(), last_element
, carry.size());
counter[i].merge(counter[i-1], p, &last_inserted);
--fill;
const_iterator last_element(counter[fill].previous(last_inserted, counter[fill].end()));
- if(constant_time_size){
+ BOOST_IF_CONSTEXPR(constant_time_size){
this->splice_after( cbefore_begin(), counter[fill], counter[fill].cbefore_begin()
, last_element, counter[fill].size());
}
//!
//! <b>Throws</b>: If value_traits::node_traits::node
//! constructor throws (this does not happen with predefined Boost.Intrusive hooks)
- //! or std::less<value_type> throws. Basic guarantee.
+ //! or operator< throws. Basic guarantee.
//!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
void sort()
- { this->sort(std::less<value_type>()); }
+ { this->sort(value_less<value_type>()); }
//! <b>Requires</b>: p must be a comparison function that induces a strict weak
//! ordering and both *this and x must be sorted according to that ordering
}
//! <b>Effects</b>: This function removes all of x's elements and inserts them
- //! in order into *this according to std::less<value_type>. The merge is stable;
+ //! in order into *this according to operator<. The merge is stable;
//! that is, if an element from *this is equivalent to one from x, then the element
//! from *this will precede the one from x.
//!
- //! <b>Throws</b>: if std::less<value_type> throws. Basic guarantee.
+ //! <b>Throws</b>: if operator< throws. Basic guarantee.
//!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
//!
//! <b>Note</b>: Iterators and references are not invalidated
void merge(slist_impl& x)
- { this->merge(x, std::less<value_type>()); }
+ { this->merge(x, value_less<value_type>()); }
//! <b>Effects</b>: Reverses the order of elements in the list.
//!
//! <b>Complexity</b>: This function is linear to the contained elements.
//!
//! <b>Note</b>: Iterators and references are not invalidated
- void reverse()
+ void reverse() BOOST_NOEXCEPT
{
if(cache_last && !this->empty()){
this->set_last_node(node_traits::get_next(this->get_root_node()));
//! <b>Effects</b>: Removes all the elements that compare equal to value.
//! No destructors are called.
//!
- //! <b>Throws</b>: If std::equal_to<value_type> throws. Basic guarantee.
+ //! <b>Throws</b>: If operator== throws. Basic guarantee.
//!
//! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality.
//!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid. This function is
//! linear time: it performs exactly size() comparisons for equality.
- void remove(const_reference value)
+ void remove(const_reference value) BOOST_NOEXCEPT
{ this->remove_if(detail::equal_to_value<const_reference>(value)); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//! <b>Effects</b>: Removes all the elements that compare equal to value.
//! Disposer::operator()(pointer) is called for every removed element.
//!
- //! <b>Throws</b>: If std::equal_to<value_type> throws. Basic guarantee.
+ //! <b>Throws</b>: If operator== throws. Basic guarantee.
//!
//! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality.
//!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
template<class Disposer>
- void remove_and_dispose(const_reference value, Disposer disposer)
+ void remove_and_dispose(const_reference value, Disposer disposer) BOOST_NOEXCEPT
{ this->remove_and_dispose_if(detail::equal_to_value<const_reference>(value), disposer); }
//! <b>Effects</b>: Removes all the elements for which a specified
node_algorithms::stable_partition
(bbeg, this->get_end_node(), detail::key_nodeptr_comp<Pred, value_traits>(pred, &this->priv_value_traits()), info);
//After cache last is set, slist invariants are preserved...
- if(cache_last){
+ BOOST_IF_CONSTEXPR(cache_last){
this->set_last_node(info.new_last_node);
}
//...so erase can be safely called
node_algorithms::stable_partition
(bbeg, this->get_end_node(), detail::key_nodeptr_comp<Pred, value_traits>(pred, &this->priv_value_traits()), info);
//After cache last is set, slist invariants are preserved...
- if(cache_last){
+ BOOST_IF_CONSTEXPR(cache_last){
this->set_last_node(info.new_last_node);
}
//...so erase can be safely called
//! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that are equal from the list. No destructors are called.
//!
- //! <b>Throws</b>: If std::equal_to<value_type> throws. Basic guarantee.
+ //! <b>Throws</b>: If operator== throws. Basic guarantee.
//!
//! <b>Complexity</b>: Linear time (size()-1) comparisons calls to pred()).
//!
//! <b>Note</b>: The relative order of elements that are not removed is unchanged,
//! and iterators to elements that are not removed remain valid.
void unique()
- { this->unique_and_dispose(std::equal_to<value_type>(), detail::null_disposer()); }
+ { this->unique_and_dispose(value_equal<value_type>(), detail::null_disposer()); }
//! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that satisfy some binary predicate from the list.
//! elements that satisfy some binary predicate from the list.
//! Disposer::operator()(pointer) is called for every removed element.
//!
- //! <b>Throws</b>: If std::equal_to<value_type> throws. Basic guarantee.
+ //! <b>Throws</b>: If operator== throws. Basic guarantee.
//!
//! <b>Complexity</b>: Linear time (size()-1) comparisons equality comparisons.
//!
//! and iterators to elements that are not removed remain valid.
template<class Disposer>
void unique_and_dispose(Disposer disposer)
- { this->unique(std::equal_to<value_type>(), disposer); }
+ { this->unique(value_equal<value_type>(), disposer); }
//! <b>Requires</b>: Disposer::operator()(pointer) shouldn't throw.
//!
++cur;
}
}
- if(cache_last){
+ BOOST_IF_CONSTEXPR(cache_last){
this->set_last_node(bcur.pointed_node());
}
}
//! <b>Note</b>: Iterators and references are not invalidated.
//! This static function is available only if the <i>value traits</i>
//! is stateless.
- static iterator s_iterator_to(reference value)
+ static iterator s_iterator_to(reference value) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT((!stateful_value_traits));
return iterator (value_traits::to_node_ptr(value), const_value_traits_ptr());
//! <b>Note</b>: Iterators and references are not invalidated.
//! This static function is available only if the <i>value traits</i>
//! is stateless.
- static const_iterator s_iterator_to(const_reference value)
+ static const_iterator s_iterator_to(const_reference value) BOOST_NOEXCEPT
{
BOOST_STATIC_ASSERT((!stateful_value_traits));
reference r =*detail::uncast(pointer_traits<const_pointer>::pointer_to(value));
//! <b>Complexity</b>: Constant time.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
- iterator iterator_to(reference value)
+ iterator iterator_to(reference value) BOOST_NOEXCEPT
{
BOOST_INTRUSIVE_INVARIANT_ASSERT(linear || !node_algorithms::inited(this->priv_value_traits().to_node_ptr(value)));
return iterator (this->priv_value_traits().to_node_ptr(value), this->priv_value_traits_ptr());
//! <b>Complexity</b>: Constant time.
//!
//! <b>Note</b>: Iterators and references are not invalidated.
- const_iterator iterator_to(const_reference value) const
+ const_iterator iterator_to(const_reference value) const BOOST_NOEXCEPT
{
reference r =*detail::uncast(pointer_traits<const_pointer>::pointer_to(value));
BOOST_INTRUSIVE_INVARIANT_ASSERT (linear || !node_algorithms::inited(this->priv_value_traits().to_node_ptr(r)));
//!
//! <b>Complexity</b>: Linear to the number of elements before i.
//! Constant if cache_last<> is true and i == end().
- iterator previous(iterator i)
+ iterator previous(iterator i) BOOST_NOEXCEPT
{ return this->previous(this->cbefore_begin(), i); }
//! <b>Returns</b>: The const_iterator to the element before i in the list.
//!
//! <b>Complexity</b>: Linear to the number of elements before i.
//! Constant if cache_last<> is true and i == end().
- const_iterator previous(const_iterator i) const
+ const_iterator previous(const_iterator i) const BOOST_NOEXCEPT
{ return this->previous(this->cbefore_begin(), i); }
//! <b>Returns</b>: The iterator to the element before i in the list,
//!
//! <b>Complexity</b>: Linear to the number of elements before i.
//! Constant if cache_last<> is true and i == end().
- iterator previous(const_iterator prev_from, iterator i)
+ iterator previous(const_iterator prev_from, iterator i) BOOST_NOEXCEPT
{ return this->previous(prev_from, const_iterator(i)).unconst(); }
//! <b>Returns</b>: The const_iterator to the element before i in the list,
//!
//! <b>Complexity</b>: Linear to the number of elements before i.
//! Constant if cache_last<> is true and i == end().
- const_iterator previous(const_iterator prev_from, const_iterator i) const
+ const_iterator previous(const_iterator prev_from, const_iterator i) const BOOST_NOEXCEPT
{
if(cache_last && (i.pointed_node() == this->get_end_node())){
return const_iterator(detail::uncast(this->get_last_node()), this->priv_value_traits_ptr());
//! point to elements of this list. Iterators of this list and all the references are not invalidated.
//!
//! <b>Warning</b>: Experimental function, don't use it!
- void incorporate_after(const_iterator prev_pos, const node_ptr & f, const node_ptr & before_l)
+ void incorporate_after(const_iterator prev_pos, node_ptr f, node_ptr before_l) BOOST_NOEXCEPT
{
- if(constant_time_size)
+ BOOST_IF_CONSTEXPR(constant_time_size)
this->incorporate_after(prev_pos, f, before_l, node_algorithms::distance(f.pointed_node(), before_l.pointed_node())+1);
else
this->priv_incorporate_after(prev_pos.pointed_node(), f, before_l);
//! point to elements of this list. Iterators of this list and all the references are not invalidated.
//!
//! <b>Warning</b>: Experimental function, don't use it!
- void incorporate_after(const_iterator prev_pos, const node_ptr & f, const node_ptr & before_l, size_type n)
+ void incorporate_after(const_iterator prev_pos, node_ptr f, node_ptr before_l, size_type n) BOOST_NOEXCEPT
{
if(n){
BOOST_INTRUSIVE_INVARIANT_ASSERT(n > 0);
, iterator(before_l, this->priv_value_traits_ptr())))
+1 == n);
this->priv_incorporate_after(prev_pos.pointed_node(), f, before_l);
- if(constant_time_size){
+ BOOST_IF_CONSTEXPR(constant_time_size){
this->priv_size_traits().increase(n);
}
}
void priv_incorporate_after(node_ptr prev_pos_n, node_ptr first_n, node_ptr before_l_n)
{
- if(cache_last){
+ BOOST_IF_CONSTEXPR(cache_last){
if(prev_pos_n == this->get_last_node()){
this->set_last_node(before_l_n);
}
void priv_shift_backwards(size_type n, detail::bool_<true>)
{
- std::pair<node_ptr, node_ptr> ret(
+ typename node_algorithms::node_pair ret(
node_algorithms::move_first_n_forward
(node_traits::get_next(this->get_root_node()), (std::size_t)n));
if(ret.first){
node_traits::set_next(this->get_root_node(), ret.first);
- if(cache_last){
+ BOOST_IF_CONSTEXPR(cache_last){
this->set_last_node(ret.second);
}
}
void priv_shift_forward(size_type n, detail::bool_<true>)
{
- std::pair<node_ptr, node_ptr> ret(
+ typename node_algorithms::node_pair ret(
node_algorithms::move_first_n_backwards
(node_traits::get_next(this->get_root_node()), (std::size_t)n));
if(ret.first){
node_traits::set_next(this->get_root_node(), ret.first);
- if(cache_last){
+ BOOST_IF_CONSTEXPR(cache_last){
this->set_last_node(ret.second);
}
}
struct incorporate_t{};
- BOOST_INTRUSIVE_FORCEINLINE slist( const node_ptr & f, const node_ptr & before_l
+ BOOST_INTRUSIVE_FORCEINLINE slist( node_ptr f, node_ptr before_l
, size_type n, const value_traits &v_traits = value_traits())
: Base(f, before_l, n, v_traits)
{}
BOOST_INTRUSIVE_FORCEINLINE void clone_from(BOOST_RV_REF(slist) src, Cloner cloner, Disposer disposer)
{ Base::clone_from(BOOST_MOVE_BASE(Base, src), cloner, disposer); }
- BOOST_INTRUSIVE_FORCEINLINE static slist &container_from_end_iterator(iterator end_iterator)
+ BOOST_INTRUSIVE_FORCEINLINE static slist &container_from_end_iterator(iterator end_iterator) BOOST_NOEXCEPT
{ return static_cast<slist &>(Base::container_from_end_iterator(end_iterator)); }
- BOOST_INTRUSIVE_FORCEINLINE static const slist &container_from_end_iterator(const_iterator end_iterator)
+ BOOST_INTRUSIVE_FORCEINLINE static const slist &container_from_end_iterator(const_iterator end_iterator) BOOST_NOEXCEPT
{ return static_cast<const slist &>(Base::container_from_end_iterator(end_iterator)); }
};