Alien-boost-mini
view release on metacpan or search on metacpan
include/boost/container/slist.hpp view on Meta::CPAN
{
typedef typename dtl::bi::make_slist_base_hook
<dtl::bi::void_pointer<VoidPointer>, dtl::bi::link_mode<dtl::bi::normal_link> >::type type;
};
template <class T, class VoidPointer>
struct slist_node
: public slist_hook<VoidPointer>::type
{
private:
slist_node();
public:
typedef T value_type;
typedef typename slist_hook<VoidPointer>::type hook_type;
T m_data;
T &get_data()
{ return this->m_data; }
const T &get_data() const
{ return this->m_data; }
};
template <class T, class VoidPointer>
struct iiterator_node_value_type< slist_node<T,VoidPointer> > {
typedef T type;
};
template<class Allocator>
struct intrusive_slist_type
{
typedef boost::container::allocator_traits<Allocator> allocator_traits_type;
typedef typename allocator_traits_type::value_type value_type;
typedef typename boost::intrusive::pointer_traits
<typename allocator_traits_type::pointer>::template
rebind_pointer<void>::type
void_pointer;
typedef typename dtl::slist_node
<value_type, void_pointer> node_type;
typedef typename dtl::bi::make_slist
<node_type
,dtl::bi::base_hook<typename slist_hook<void_pointer>::type>
,dtl::bi::constant_time_size<true>
, dtl::bi::size_type
<typename allocator_traits_type::size_type>
>::type container_type;
typedef container_type type ;
};
} //namespace dtl {
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! An slist is a singly linked list: a list where each element is linked to the next
//! element, but not to the previous element. That is, it is a Sequence that
//! supports forward but not backward traversal, and (amortized) constant time
//! insertion and removal of elements. Slists, like lists, have the important
//! property that insertion and splicing do not invalidate iterators to list elements,
//! and that even removal invalidates only the iterators that point to the elements
//! that are removed. The ordering of iterators may be changed (that is,
//! slist<T>::iterator might have a different predecessor or successor after a list
//! operation than it did before), but the iterators themselves will not be invalidated
//! or made to point to different elements unless that invalidation or mutation is explicit.
//!
//! The main difference between slist and list is that list's iterators are bidirectional
//! iterators, while slist's iterators are forward iterators. This means that slist is
//! less versatile than list; frequently, however, bidirectional iterators are
//! unnecessary. You should usually use slist unless you actually need the extra
//! functionality of list, because singly linked lists are smaller and faster than double
//! linked lists.
//!
//! Important performance note: like every other Sequence, slist defines the member
//! functions insert and erase. Using these member functions carelessly, however, can
//! result in disastrously slow programs. The problem is that insert's first argument is
//! an iterator p, and that it inserts the new element(s) before p. This means that
//! insert must find the iterator just before p; this is a constant-time operation
//! for list, since list has bidirectional iterators, but for slist it must find that
//! iterator by traversing the list from the beginning up to p. In other words:
//! insert and erase are slow operations anywhere but near the beginning of the slist.
//!
//! Slist provides the member functions insert_after and erase_after, which are constant
//! time operations: you should always use insert_after and erase_after whenever
//! possible. If you find that insert_after and erase_after aren't adequate for your
//! needs, and that you often need to use insert and erase in the middle of the list,
//! then you should probably use list instead of slist.
//!
//! \tparam T The type of object that is stored in the list
//! \tparam Allocator The allocator used for all internal memory management
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class Allocator = new_allocator<T> >
#else
template <class T, class Allocator>
#endif
class slist
: protected dtl::node_alloc_holder
<Allocator, typename dtl::intrusive_slist_type<Allocator>::type>
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef typename
dtl::intrusive_slist_type<Allocator>::type Icont;
typedef dtl::node_alloc_holder<Allocator, Icont> AllocHolder;
typedef typename AllocHolder::NodePtr NodePtr;
typedef typename AllocHolder::NodeAlloc NodeAlloc;
typedef typename AllocHolder::ValAlloc ValAlloc;
typedef typename AllocHolder::Node Node;
typedef dtl::allocator_destroyer<NodeAlloc> Destroyer;
typedef typename AllocHolder::alloc_version alloc_version;
typedef boost::container::
allocator_traits<Allocator> allocator_traits_type;
typedef boost::container::equal_to_value<Allocator> equal_to_value_type;
BOOST_COPYABLE_AND_MOVABLE(slist)
typedef dtl::iterator_from_iiterator<typename Icont::iterator, false> iterator_impl;
typedef dtl::iterator_from_iiterator<typename Icont::iterator, true > const_iterator_impl;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
//////////////////////////////////////////////
//
// types
//
//////////////////////////////////////////////
include/boost/container/slist.hpp view on Meta::CPAN
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Requires</b>: prev_p must be a valid iterator of *this.
//!
//! <b>Effects</b>: Inserts the range pointed by [il.begin(), il.end()) after prev_p.
//!
//! <b>Returns</b>: an iterator to the last inserted element or prev_p if il.begin() == il.end().
//!
//! <b>Throws</b>: If memory allocation throws, T's constructor from a
//! dereferenced std::initializer_list iterator throws.
//!
//! <b>Complexity</b>: Linear to the number of elements inserted.
//!
//! <b>Note</b>: Does not affect the validity of iterators and references of
//! previous values.
iterator insert_after(const_iterator prev_p, std::initializer_list<value_type> il)
{
return insert_after(prev_p, il.begin(), il.end());
}
#endif
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
template <class FwdIt>
iterator insert_after(const_iterator prev, FwdIt first, FwdIt last
, typename dtl::enable_if_c
< !dtl::is_convertible<FwdIt, size_type>::value
&& !(dtl::is_input_iterator<FwdIt>::value
|| dtl::is_same<alloc_version, version_1>::value
)
>::type * = 0
)
{
//Optimized allocation and construction
insertion_functor func(this->icont(), prev.get());
this->allocate_many_and_construct(first, boost::container::iterator_distance(first, last), func);
return iterator(func.inserted_first());
}
#endif
//! <b>Effects</b>: Removes the first element from the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Amortized constant time.
void pop_front()
{
BOOST_ASSERT(!this->empty());
this->icont().pop_front_and_dispose(Destroyer(this->node_alloc()));
}
//! <b>Effects</b>: Erases the element after the element pointed by prev_p
//! of the list.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: Does not invalidate iterators or references to non erased elements.
iterator erase_after(const_iterator prev_p)
{
return iterator(this->icont().erase_after_and_dispose(prev_p.get(), Destroyer(this->node_alloc())));
}
//! <b>Effects</b>: Erases the range (before_first, last) from
//! the list.
//!
//! <b>Returns</b>: the first element remaining beyond the removed elements,
//! or end() if no such element exists.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of erased elements.
//!
//! <b>Note</b>: Does not invalidate iterators or references to non erased elements.
iterator erase_after(const_iterator before_first, const_iterator last)
{
return iterator(this->icont().erase_after_and_dispose(before_first.get(), last.get(), Destroyer(this->node_alloc())));
}
//! <b>Effects</b>: Swaps the contents of *this and x.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements on *this and x.
void swap(slist& x)
BOOST_NOEXCEPT_IF( allocator_traits_type::propagate_on_container_swap::value
|| allocator_traits_type::is_always_equal::value)
{
BOOST_ASSERT(allocator_traits_type::propagate_on_container_swap::value ||
allocator_traits_type::is_always_equal::value ||
this->get_stored_allocator() == x.get_stored_allocator());
AllocHolder::swap(x);
}
//! <b>Effects</b>: Erases all the elements of the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements in the list.
void clear()
{ this->icont().clear_and_dispose(Destroyer(this->node_alloc())); }
//////////////////////////////////////////////
//
// slist operations
//
//////////////////////////////////////////////
//! <b>Requires</b>: p must point to an element contained
//! by the list. x != *this
//!
//! <b>Effects</b>: Transfers all the elements of list x to this list, after the
//! the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator
//! are not equal.
//!
//! <b>Complexity</b>: Linear to the elements in x.
//!
//! <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_p, slist& x) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(this != &x);
BOOST_ASSERT(this->node_alloc() == x.node_alloc());
this->icont().splice_after(prev_p.get(), x.icont());
}
//! <b>Requires</b>: p must point to an element contained
//! by the list. x != *this
//!
//! <b>Effects</b>: Transfers all the elements of list x to this list, after the
//! the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator
//! are not equal.
//!
//! <b>Complexity</b>: Linear to the elements in x.
//!
//! <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_p, BOOST_RV_REF(slist) x) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice_after(prev_p, static_cast<slist&>(x)); }
//! <b>Requires</b>: prev_p must be a valid iterator of this.
//! i must point to an element contained in list x.
//! this' allocator and x's allocator shall compare equal.
//!
//! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
//! after the element pointed by prev_p.
//! If prev_p == prev or prev_p == ++prev, this function is a null operation.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Constant.
//!
//! <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_p, slist& x, const_iterator prev) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(this->node_alloc() == x.node_alloc());
this->icont().splice_after(prev_p.get(), x.icont(), prev.get());
}
//! <b>Requires</b>: prev_p must be a valid iterator of this.
//! i must point to an element contained in list x.
//! this' allocator and x's allocator shall compare equal.
//!
//! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
//! after the element pointed by prev_p.
//! If prev_p == prev or prev_p == ++prev, this function is a null operation.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Constant.
//!
//! <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_p, BOOST_RV_REF(slist) x, const_iterator prev) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice_after(prev_p, static_cast<slist&>(x), prev); }
//! <b>Requires</b>: prev_p must be a valid iterator of this.
//! before_first and before_last must be valid iterators of x.
//! prev_p must not be contained in [before_first, before_last) range.
//! this' allocator and x's allocator shall compare equal.
//!
//! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1)
//! from list x to this list, after the element pointed by prev_p.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear to the number of transferred elements.
//!
//! <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_p, slist& x,
const_iterator before_first, const_iterator before_last) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(this->node_alloc() == x.node_alloc());
this->icont().splice_after
(prev_p.get(), x.icont(), before_first.get(), before_last.get());
}
//! <b>Requires</b>: prev_p must be a valid iterator of this.
//! before_first and before_last must be valid iterators of x.
//! prev_p must not be contained in [before_first, before_last) range.
//! this' allocator and x's allocator shall compare equal.
//!
//! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1)
//! from list x to this list, after the element pointed by prev_p.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear to the number of transferred elements.
//!
//! <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_p, BOOST_RV_REF(slist) x,
const_iterator before_first, const_iterator before_last) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice_after(prev_p, static_cast<slist&>(x), before_first, before_last); }
//! <b>Requires</b>: prev_p must be a valid iterator of this.
//! before_first and before_last must be valid iterators of x.
//! prev_p must not be contained in [before_first, before_last) range.
//! n == distance(before_first, before_last).
//! this' allocator and x's allocator shall compare equal.
//!
//! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1)
//! from list x to this list, after the element pointed by prev_p.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Constant.
//!
//! <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_p, slist& x,
const_iterator before_first, const_iterator before_last,
size_type n) BOOST_NOEXCEPT_OR_NOTHROW
{
BOOST_ASSERT(this->node_alloc() == x.node_alloc());
this->icont().splice_after
(prev_p.get(), x.icont(), before_first.get(), before_last.get(), n);
}
//! <b>Requires</b>: prev_p must be a valid iterator of this.
//! before_first and before_last must be valid iterators of x.
//! prev_p must not be contained in [before_first, before_last) range.
//! n == distance(before_first, before_last).
//! this' allocator and x's allocator shall compare equal.
//!
//! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1)
//! from list x to this list, after the element pointed by prev_p.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Constant.
//!
//! <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_p, BOOST_RV_REF(slist) x,
const_iterator before_first, const_iterator before_last,
size_type n) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice_after(prev_p, static_cast<slist&>(x), before_first, before_last, n); }
//! <b>Effects</b>: Removes all the elements that compare equal to value.
//!
//! <b>Throws</b>: Nothing.
//!
//! <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.
void remove(const T& value)
{ this->remove_if(equal_to_value_type(value)); }
//! <b>Effects</b>: Removes all the elements for which a specified
//! predicate is satisfied.
//!
//! <b>Throws</b>: If pred throws.
//!
//! <b>Complexity</b>: Linear time. It performs exactly size() calls to the predicate.
//!
//! <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 Pred>
void remove_if(Pred pred)
{
typedef value_to_node_compare<Node, Pred> value_to_node_compare_type;
this->icont().remove_and_dispose_if(value_to_node_compare_type(pred), Destroyer(this->node_alloc()));
}
//! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that are equal from the list.
//!
//! <b>Throws</b>: If comparison throws.
//!
//! <b>Complexity</b>: Linear time (size()-1 comparisons equality comparisons).
//!
//! <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(value_equal_t()); }
//! <b>Effects</b>: Removes adjacent duplicate elements or adjacent
//! elements that satisfy some binary predicate from the list.
//!
//! <b>Throws</b>: If pred throws.
//!
//! <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.
template <class Pred>
void unique(Pred pred)
{
typedef value_to_node_compare<Node, Pred> value_to_node_compare_type;
this->icont().unique_and_dispose(value_to_node_compare_type(pred), Destroyer(this->node_alloc()));
}
//! <b>Requires</b>: The lists x and *this must be distinct.
//!
//! <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;
//! 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 comparison throws.
//!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
void merge(slist & x)
{ this->merge(x, value_less_t()); }
//! <b>Requires</b>: The lists x and *this must be distinct.
//!
//! <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;
//! 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 comparison throws.
//!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
void merge(BOOST_RV_REF(slist) x)
{ this->merge(static_cast<slist&>(x)); }
//! <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
//! The lists x and *this must be distinct.
//!
//! <b>Effects</b>: This function removes all of x's elements and inserts them
//! in order into *this. 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 comp throws.
//!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
//!
//! <b>Note</b>: Iterators and references to *this are not invalidated.
template <class StrictWeakOrdering>
void merge(slist& x, StrictWeakOrdering comp)
{
typedef value_to_node_compare<Node, StrictWeakOrdering> value_to_node_compare_type;
BOOST_ASSERT(this->node_alloc() == x.node_alloc());
this->icont().merge(x.icont(), value_to_node_compare_type(comp));
}
//! <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
//! The lists x and *this must be distinct.
//!
//! <b>Effects</b>: This function removes all of x's elements and inserts them
//! in order into *this. 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 comp throws.
//!
//! <b>Complexity</b>: This function is linear time: it performs at most
//! size() + x.size() - 1 comparisons.
//!
//! <b>Note</b>: Iterators and references to *this are not invalidated.
template <class StrictWeakOrdering>
void merge(BOOST_RV_REF(slist) x, StrictWeakOrdering comp)
{ this->merge(static_cast<slist&>(x), comp); }
//! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
//!
//! <b>Throws</b>: If comparison throws.
//!
//! <b>Notes</b>: Iterators and references are not invalidated.
//!
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
//! is the list's size.
void sort()
{ this->sort(value_less_t()); }
//! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>.
//! The sort is stable, that is, the relative order of equivalent elements is preserved.
//!
//! <b>Throws</b>: If comp throws.
//!
//! <b>Notes</b>: Iterators and references are not invalidated.
//!
//! <b>Complexity</b>: The number of comparisons is approximately N log N, where N
//! is the list's size.
template <class StrictWeakOrdering>
void sort(StrictWeakOrdering comp)
{
typedef value_to_node_compare<Node, StrictWeakOrdering> value_to_node_compare_type;
// nothing if the slist has length 0 or 1.
if (this->size() < 2)
return;
this->icont().sort(value_to_node_compare_type(comp));
}
//! <b>Effects</b>: Reverses the order of elements in the list.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: This function is linear time.
//!
//! <b>Note</b>: Iterators and references are not invalidated
void reverse() BOOST_NOEXCEPT_OR_NOTHROW
{ this->icont().reverse(); }
//////////////////////////////////////////////
//
// list compatibility interface
//
//////////////////////////////////////////////
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... before p
//!
//! <b>Throws</b>: If memory allocation throws or
//! T's in-place constructor throws.
//!
//! <b>Complexity</b>: Linear to the elements before p
template <class... Args>
iterator emplace(const_iterator p, BOOST_FWD_REF(Args)... args)
{ return this->emplace_after(this->previous(p), boost::forward<Args>(args)...); }
#else
#define BOOST_CONTAINER_SLIST_EMPLACE_CODE(N) \
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
iterator emplace(const_iterator p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\
{\
return this->emplace_after(this->previous(p) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\
}\
//
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SLIST_EMPLACE_CODE)
#undef BOOST_CONTAINER_SLIST_EMPLACE_CODE
#endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Requires</b>: p must be a valid iterator of *this.
//!
//! <b>Effects</b>: Insert a copy of x before p.
//!
//! <b>Returns</b>: an iterator to the inserted element.
//!
//! <b>Throws</b>: If memory allocation throws or x's copy constructor throws.
//!
//! <b>Complexity</b>: Linear to the elements before p.
iterator insert(const_iterator p, const T &x);
//! <b>Requires</b>: p must be a valid iterator of *this.
//!
//! <b>Effects</b>: Insert a new element before p with x's resources.
//!
//! <b>Returns</b>: an iterator to the inserted element.
//!
//! <b>Throws</b>: If memory allocation throws.
//!
//! <b>Complexity</b>: Linear to the elements before p.
iterator insert(const_iterator prev_p, T &&x);
#else
BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator, const_iterator)
include/boost/container/slist.hpp view on Meta::CPAN
//! <b>Complexity</b>: Linear to distance [first, last) plus
//! linear to the elements before p.
template <class InIter>
iterator insert(const_iterator p, InIter first, InIter last)
{
const_iterator prev(this->previous(p));
this->insert_after(prev, first, last);
return ++iterator(prev.get());
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! <b>Requires</b>: p must be a valid iterator of *this.
//!
//! <b>Effects</b>: Insert a copy of the [il.begin(), il.end()) range before p.
//!
//! <b>Returns</b>: an iterator to the first inserted element or p if il.begin() == il.end().
//!
//! <b>Throws</b>: If memory allocation throws, T's constructor from a
//! dereferenced std::initializer_list iterator throws.
//!
//! <b>Complexity</b>: Linear to the range [il.begin(), il.end()) plus
//! linear to the elements before p.
iterator insert(const_iterator p, std::initializer_list<value_type> il)
{
return insert(p, il.begin(), il.end());
}
#endif
//! <b>Requires</b>: p must be a valid iterator of *this.
//!
//! <b>Effects</b>: Erases the element at p.
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the number of elements before p.
iterator erase(const_iterator p) BOOST_NOEXCEPT_OR_NOTHROW
{ return iterator(this->erase_after(previous(p))); }
//! <b>Requires</b>: first and last must be valid iterator to elements in *this.
//!
//! <b>Effects</b>: Erases the elements pointed by [first, last).
//!
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Linear to the distance between first and last plus
//! linear to the elements before first.
iterator erase(const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW
{ return iterator(this->erase_after(previous(first), last)); }
//! <b>Requires</b>: p must point to an element contained
//! by the list. x != *this. this' allocator and x's allocator shall compare equal
//!
//! <b>Effects</b>: Transfers all the elements of list x to this list, before the
//! the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear in distance(begin(), p), and linear in x.size().
//!
//! <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 p, slist& x) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice_after(this->previous(p), x); }
//! <b>Requires</b>: p must point to an element contained
//! by the list. x != *this. this' allocator and x's allocator shall compare equal
//!
//! <b>Effects</b>: Transfers all the elements of list x to this list, before the
//! the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear in distance(begin(), p), and linear in x.size().
//!
//! <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 p, BOOST_RV_REF(slist) x) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice(p, static_cast<slist&>(x)); }
//! <b>Requires</b>: p must point to an element contained
//! by this list. i must point to an element contained in list x.
//! this' allocator and x's allocator shall compare equal
//!
//! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
//! before the element pointed by p. No destructors or copy constructors are called.
//! If p == i or p == ++i, this function is a null operation.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear in distance(begin(), p), and in distance(x.begin(), i).
//!
//! <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 p, slist& x, const_iterator i) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice_after(this->previous(p), x, x.previous(i)); }
//! <b>Requires</b>: p must point to an element contained
//! by this list. i must point to an element contained in list x.
//! this' allocator and x's allocator shall compare equal.
//!
//! <b>Effects</b>: Transfers the value pointed by i, from list x to this list,
//! before the element pointed by p. No destructors or copy constructors are called.
//! If p == i or p == ++i, this function is a null operation.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear in distance(begin(), p), and in distance(x.begin(), i).
//!
//! <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 p, BOOST_RV_REF(slist) x, const_iterator i) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice(p, static_cast<slist&>(x), i); }
//! <b>Requires</b>: p must point to an element contained
//! by this list. first and last must point to elements contained in list x.
//!
//! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
//! before the element pointed by p. No destructors or copy constructors are called.
//! this' allocator and x's allocator shall compare equal.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear in distance(begin(), p), in distance(x.begin(), first),
//! and in distance(first, last).
//!
//! <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 p, slist& x, const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice_after(this->previous(p), x, x.previous(first), x.previous(last)); }
//! <b>Requires</b>: p must point to an element contained
//! by this list. first and last must point to elements contained in list x.
//! this' allocator and x's allocator shall compare equal
//!
//! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list,
//! before the element pointed by p. No destructors or copy constructors are called.
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Linear in distance(begin(), p), in distance(x.begin(), first),
//! and in distance(first, last).
//!
//! <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 p, BOOST_RV_REF(slist) x, const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW
{ this->splice(p, static_cast<slist&>(x), first, last); }
//! <b>Effects</b>: Returns true if x and y are equal
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
friend bool operator==(const slist& x, const slist& y)
{ return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); }
//! <b>Effects</b>: Returns true if x and y are unequal
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
friend bool operator!=(const slist& x, const slist& y)
{ return !(x == y); }
//! <b>Effects</b>: Returns true if x is less than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
friend bool operator<(const slist& x, const slist& y)
{ return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
//! <b>Effects</b>: Returns true if x is greater than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
friend bool operator>(const slist& x, const slist& y)
{ return y < x; }
//! <b>Effects</b>: Returns true if x is equal or less than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
friend bool operator<=(const slist& x, const slist& y)
{ return !(y < x); }
//! <b>Effects</b>: Returns true if x is equal or greater than y
//!
//! <b>Complexity</b>: Linear to the number of elements in the container.
friend bool operator>=(const slist& x, const slist& y)
{ return !(x < y); }
//! <b>Effects</b>: x.swap(y)
//!
//! <b>Complexity</b>: Constant.
friend void swap(slist& x, slist& y)
{ x.swap(y); }
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
void priv_push_front (const T &x)
{ this->insert_after(this->cbefore_begin(), x); }
void priv_push_front (BOOST_RV_REF(T) x)
{ this->insert_after(this->cbefore_begin(), ::boost::move(x)); }
bool priv_try_shrink(size_type new_size, const_iterator &last_pos)
{
typename Icont::iterator end_n(this->icont().end()), cur(this->icont().before_begin()), cur_next;
while (++(cur_next = cur) != end_n && new_size > 0){
--new_size;
cur = cur_next;
( run in 0.560 second using v1.01-cache-2.11-cpan-140bd7fdf52 )