An slist is a singly linked list: a list where each element is linked to the next element, but not to the previous element. More...
#include <slist.hpp>
Public Types | |
typedef T | value_type |
typedef ::boost::container::allocator_traits < Allocator >::pointer | pointer |
typedef ::boost::container::allocator_traits < Allocator >::const_pointer | const_pointer |
typedef ::boost::container::allocator_traits < Allocator >::reference | reference |
typedef ::boost::container::allocator_traits < Allocator >::const_reference | const_reference |
typedef ::boost::container::allocator_traits < Allocator >::size_type | size_type |
typedef ::boost::container::allocator_traits < Allocator >::difference_type | difference_type |
typedef Allocator | allocator_type |
Public Member Functions | |
typedef | BOOST_CONTAINER_IMPDEF (NodeAlloc) stored_allocator_type |
typedef | BOOST_CONTAINER_IMPDEF (iterator_impl) iterator |
typedef | BOOST_CONTAINER_IMPDEF (const_iterator_impl) const _iterator |
slist () | |
Effects: Constructs a list taking the allocator as parameter. More... | |
slist (const allocator_type &a) BOOST_CONTAINER_NOEXCEPT | |
Effects: Constructs a list taking the allocator as parameter. More... | |
slist (size_type n) | |
slist (size_type n, const value_type &x, const allocator_type &a=allocator_type()) | |
Effects: Constructs a list that will use a copy of allocator a and inserts n copies of value. More... | |
template<class InpIt > | |
slist (InpIt first, InpIt last, const allocator_type &a=allocator_type()) | |
Effects: Constructs a list that will use a copy of allocator a and inserts a copy of the range [first, last) in the list. More... | |
slist (std::initializer_list< value_type > il, const allocator_type &a=allocator_type()) | |
Effects: Constructs a list that will use a copy of allocator a and inserts a copy of the range [il.begin(), il.end()) in the list. More... | |
slist (const slist &x) | |
Effects: Copy constructs a list. More... | |
slist (BOOST_RV_REF(slist) x) | |
Effects: Move constructor. More... | |
slist (const slist &x, const allocator_type &a) | |
Effects: Copy constructs a list using the specified allocator. More... | |
slist (BOOST_RV_REF(slist) x, const allocator_type &a) | |
Effects: Move constructor using the specified allocator. More... | |
~slist () BOOST_CONTAINER_NOEXCEPT | |
Effects: Destroys the list. More... | |
slist & | operator= (BOOST_COPY_ASSIGN_REF(slist) x) |
Effects: Makes *this contain the same elements as x. More... | |
slist & | operator= (BOOST_RV_REF(slist) x) BOOST_CONTAINER_NOEXCEPT_IF(allocator_traits_type |
Effects: Makes *this contain the same elements as x. More... | |
slist & | operator= (std::initializer_list< value_type > il) |
Effects: Makes *this contain the same elements as in il. More... | |
void | assign (size_type n, const T &val) |
Effects: Assigns the n copies of val to *this. More... | |
template<class InpIt > | |
void | assign (InpIt first, InpIt last, typename container_detail::enable_if_c< !container_detail::is_convertible< InpIt, size_type >::value >::type *=0) |
Effects: Assigns the range [first, last) to *this. More... | |
void | assign (std::initializer_list< value_type > il) |
Effects: Assigns the range [il.begin(), il.end()) to *this. More... | |
allocator_type | get_allocator () const BOOST_CONTAINER_NOEXCEPT |
Effects: Returns a copy of the internal allocator. More... | |
stored_allocator_type & | get_stored_allocator () BOOST_CONTAINER_NOEXCEPT |
Effects: Returns a reference to the internal allocator. More... | |
const stored_allocator_type & | get_stored_allocator () const BOOST_CONTAINER_NOEXCEPT |
Effects: Returns a reference to the internal allocator. More... | |
iterator | before_begin () BOOST_CONTAINER_NOEXCEPT |
Effects: Returns a non-dereferenceable iterator that, when incremented, yields begin(). More... | |
const_iterator | before_begin () const BOOST_CONTAINER_NOEXCEPT |
Effects: Returns a non-dereferenceable const_iterator that, when incremented, yields begin(). More... | |
iterator | begin () BOOST_CONTAINER_NOEXCEPT |
Effects: Returns an iterator to the first element contained in the list. More... | |
const_iterator | begin () const BOOST_CONTAINER_NOEXCEPT |
Effects: Returns a const_iterator to the first element contained in the list. More... | |
iterator | end () BOOST_CONTAINER_NOEXCEPT |
Effects: Returns an iterator to the end of the list. More... | |
const_iterator | end () const BOOST_CONTAINER_NOEXCEPT |
Effects: Returns a const_iterator to the end of the list. More... | |
const_iterator | cbefore_begin () const BOOST_CONTAINER_NOEXCEPT |
Effects: Returns a non-dereferenceable const_iterator that, when incremented, yields begin(). More... | |
const_iterator | cbegin () const BOOST_CONTAINER_NOEXCEPT |
Effects: Returns a const_iterator to the first element contained in the list. More... | |
const_iterator | cend () const BOOST_CONTAINER_NOEXCEPT |
Effects: Returns a const_iterator to the end of the list. More... | |
iterator | previous (iterator p) BOOST_CONTAINER_NOEXCEPT |
Returns: The iterator to the element before i in the sequence. More... | |
const_iterator | previous (const_iterator p) |
Returns: The const_iterator to the element before i in the sequence. More... | |
bool | empty () const |
Effects: Returns true if the list contains no elements. More... | |
size_type | size () const |
Effects: Returns the number of the elements contained in the list. More... | |
size_type | max_size () const |
Effects: Returns the largest possible size of the list. More... | |
void | resize (size_type new_size) |
Effects: Inserts or erases elements at the end such that the size becomes n. More... | |
void | resize (size_type new_size, const T &x) |
Effects: Inserts or erases elements at the end such that the size becomes n. More... | |
reference | front () |
Requires: !empty() More... | |
const_reference | front () const |
Requires: !empty() More... | |
iterator | insert_after (const_iterator prev_p, size_type n, const value_type &x) |
Requires: prev_p must be a valid iterator of *this. More... | |
template<class InpIt > | |
iterator | insert_after (const_iterator prev_p, InpIt first, InpIt last, typename container_detail::enable_if_c< !container_detail::is_convertible< InpIt, size_type >::value &&(container_detail::is_input_iterator< InpIt >::value||container_detail::is_same< alloc_version, allocator_v1 >::value) >::type *=0) |
Requires: prev_p must be a valid iterator of *this. More... | |
iterator | insert_after (const_iterator prev_p, std::initializer_list< value_type > il) |
Requires: prev_p must be a valid iterator of *this. More... | |
template<class FwdIt > | |
iterator | insert_after (const_iterator prev, FwdIt first, FwdIt last, typename container_detail::enable_if_c< !container_detail::is_convertible< FwdIt, size_type >::value &&!(container_detail::is_input_iterator< FwdIt >::value||container_detail::is_same< alloc_version, allocator_v1 >::value) >::type *=0) |
void | pop_front () |
Effects: Removes the first element from the list. More... | |
iterator | erase_after (const_iterator prev_p) |
Effects: Erases the element after the element pointed by prev_p of the list. More... | |
iterator | erase_after (const_iterator before_first, const_iterator last) |
Effects: Erases the range (before_first, last) from the list. More... | |
void | swap (slist &x) |
Effects: Swaps the contents of *this and x. More... | |
void | clear () |
Effects: Erases all the elements of the list. More... | |
void | splice_after (const_iterator prev_p, slist &x) BOOST_CONTAINER_NOEXCEPT |
Requires: p must point to an element contained by the list. More... | |
void | splice_after (const_iterator prev_p, BOOST_RV_REF(slist) x) BOOST_CONTAINER_NOEXCEPT |
Requires: p must point to an element contained by the list. More... | |
void | splice_after (const_iterator prev_p, slist &x, const_iterator prev) BOOST_CONTAINER_NOEXCEPT |
Requires: prev_p must be a valid iterator of this. More... | |
void | splice_after (const_iterator prev_p, BOOST_RV_REF(slist) x, const_iterator prev) BOOST_CONTAINER_NOEXCEPT |
Requires: prev_p must be a valid iterator of this. More... | |
void | splice_after (const_iterator prev_p, slist &x, const_iterator before_first, const_iterator before_last) BOOST_CONTAINER_NOEXCEPT |
Requires: prev_p must be a valid iterator of this. More... | |
void | splice_after (const_iterator prev_p, BOOST_RV_REF(slist) x, const_iterator before_first, const_iterator before_last) BOOST_CONTAINER_NOEXCEPT |
Requires: prev_p must be a valid iterator of this. More... | |
void | splice_after (const_iterator prev_p, slist &x, const_iterator before_first, const_iterator before_last, size_type n) BOOST_CONTAINER_NOEXCEPT |
Requires: prev_p must be a valid iterator of this. More... | |
void | splice_after (const_iterator prev_p, BOOST_RV_REF(slist) x, const_iterator before_first, const_iterator before_last, size_type n) BOOST_CONTAINER_NOEXCEPT |
Requires: prev_p must be a valid iterator of this. More... | |
void | remove (const T &value) |
Effects: Removes all the elements that compare equal to value. More... | |
template<class Pred > | |
void | remove_if (Pred pred) |
Effects: Removes all the elements for which a specified predicate is satisfied. More... | |
void | unique () |
Effects: Removes adjacent duplicate elements or adjacent elements that are equal from the list. More... | |
template<class Pred > | |
void | unique (Pred pred) |
Effects: Removes adjacent duplicate elements or adjacent elements that satisfy some binary predicate from the list. More... | |
void | merge (slist &x) |
Requires: The lists x and *this must be distinct. More... | |
void | merge (BOOST_RV_REF(slist) x) |
Requires: The lists x and *this must be distinct. More... | |
template<class StrictWeakOrdering > | |
void | merge (slist &x, StrictWeakOrdering comp) |
Requires: 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. More... | |
template<class StrictWeakOrdering > | |
void | merge (BOOST_RV_REF(slist) x, StrictWeakOrdering comp) |
Requires: 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. More... | |
void | sort () |
Effects: This function sorts the list *this according to std::less<value_type>. More... | |
template<class StrictWeakOrdering > | |
void | sort (StrictWeakOrdering comp) |
Effects: This function sorts the list *this according to std::less<value_type>. More... | |
void | reverse () BOOST_CONTAINER_NOEXCEPT |
Effects: Reverses the order of elements in the list. More... | |
iterator | insert (const_iterator p, size_type n, const value_type &x) |
Requires: p must be a valid iterator of *this. More... | |
template<class InIter > | |
iterator | insert (const_iterator p, InIter first, InIter last) |
Requires: p must be a valid iterator of *this. More... | |
iterator | insert (const_iterator p, std::initializer_list< value_type > il) |
Requires: p must be a valid iterator of *this. More... | |
iterator | erase (const_iterator p) BOOST_CONTAINER_NOEXCEPT |
Requires: p must be a valid iterator of *this. More... | |
iterator | erase (const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT |
Requires: first and last must be valid iterator to elements in *this. More... | |
void | splice (const_iterator p, slist &x) BOOST_CONTAINER_NOEXCEPT |
Requires: p must point to an element contained by the list. More... | |
void | splice (const_iterator p, BOOST_RV_REF(slist) x) BOOST_CONTAINER_NOEXCEPT |
Requires: p must point to an element contained by the list. More... | |
void | splice (const_iterator p, slist &x, const_iterator i) BOOST_CONTAINER_NOEXCEPT |
Requires: p must point to an element contained by this list. More... | |
void | splice (const_iterator p, BOOST_RV_REF(slist) x, const_iterator i) BOOST_CONTAINER_NOEXCEPT |
Requires: p must point to an element contained by this list. More... | |
void | splice (const_iterator p, slist &x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT |
Requires: p must point to an element contained by this list. More... | |
void | splice (const_iterator p, BOOST_RV_REF(slist) x, const_iterator first, const_iterator last) BOOST_CONTAINER_NOEXCEPT |
Requires: p must point to an element contained by this list. More... | |
Friends | |
class | insertion_functor |
bool | operator== (const slist &x, const slist &y) |
Effects: Returns true if x and y are equal More... | |
bool | operator!= (const slist &x, const slist &y) |
Effects: Returns true if x and y are unequal More... | |
bool | operator< (const slist &x, const slist &y) |
Effects: Returns true if x is less than y More... | |
bool | operator> (const slist &x, const slist &y) |
Effects: Returns true if x is greater than y More... | |
bool | operator<= (const slist &x, const slist &y) |
Effects: Returns true if x is equal or less than y More... | |
bool | operator>= (const slist &x, const slist &y) |
Effects: Returns true if x is equal or greater than y More... | |
void | swap (slist &x, slist &y) |
Effects: x.swap(y) More... | |
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.
T | The type of object that is stored in the list |
Allocator | The allocator used for all internal memory management |
typedef Allocator boost::container::slist< T, Allocator >::allocator_type |
typedef ::boost::container::allocator_traits<Allocator>::const_pointer boost::container::slist< T, Allocator >::const_pointer |
typedef ::boost::container::allocator_traits<Allocator>::const_reference boost::container::slist< T, Allocator >::const_reference |
typedef ::boost::container::allocator_traits<Allocator>::difference_type boost::container::slist< T, Allocator >::difference_type |
typedef ::boost::container::allocator_traits<Allocator>::pointer boost::container::slist< T, Allocator >::pointer |
typedef ::boost::container::allocator_traits<Allocator>::reference boost::container::slist< T, Allocator >::reference |
typedef ::boost::container::allocator_traits<Allocator>::size_type boost::container::slist< T, Allocator >::size_type |
typedef T boost::container::slist< T, Allocator >::value_type |
|
inline |
Effects: Constructs a list taking the allocator as parameter.
Throws: If allocator_type's copy constructor throws.
Complexity: Constant.
|
inlineexplicit |
Effects: Constructs a list taking the allocator as parameter.
Throws: Nothing
Complexity: Constant.
|
inlineexplicit |
|
inlineexplicit |
Effects: Constructs a list that will use a copy of allocator a and inserts n copies of value.
Throws: If allocator_type's default constructor throws or T's default or copy constructor throws.
Complexity: Linear to n.
References boost::container::slist< T, Allocator >::cbefore_begin(), and boost::container::slist< T, Allocator >::insert_after().
|
inline |
Effects: Constructs a list that will use a copy of allocator a and inserts a copy of the range [first, last) in the list.
Throws: If allocator_type's default constructor throws or T's constructor taking a dereferenced InIt throws.
Complexity: Linear to the range [first, last).
References boost::container::slist< T, Allocator >::cbefore_begin(), and boost::container::slist< T, Allocator >::insert_after().
|
inline |
Effects: Constructs a list that will use a copy of allocator a and inserts a copy of the range [il.begin(), il.end()) in the list.
Throws: If allocator_type's default constructor throws or T's constructor taking a dereferenced std::initializer_list iterator throws.
Complexity: Linear to the range [il.begin(), il.end()).
|
inline |
Effects: Copy constructs a list.
Postcondition: x == *this.
Throws: If allocator_type's default constructor
Complexity: Linear to the elements x contains.
References boost::container::slist< T, Allocator >::begin(), boost::container::slist< T, Allocator >::cbefore_begin(), boost::container::slist< T, Allocator >::end(), and boost::container::slist< T, Allocator >::insert_after().
|
inline |
Effects: Move constructor.
Moves mx's resources to *this.
Throws: If allocator_type's copy constructor throws.
Complexity: Constant.
|
inline |
Effects: Copy constructs a list using the specified allocator.
Postcondition: x == *this.
Throws: If allocator_type's default constructor
Complexity: Linear to the elements x contains.
References boost::container::slist< T, Allocator >::begin(), boost::container::slist< T, Allocator >::cbefore_begin(), boost::container::slist< T, Allocator >::end(), and boost::container::slist< T, Allocator >::insert_after().
|
inline |
Effects: Move constructor using the specified allocator.
Moves x's resources to *this.
Throws: If allocation or value_type's copy constructor throws.
Complexity: Constant if a == x.get_allocator(), linear otherwise.
References boost::container::slist< T, Allocator >::begin(), boost::container::slist< T, Allocator >::cbefore_begin(), boost::container::slist< T, Allocator >::end(), and boost::container::slist< T, Allocator >::insert_after().
|
inline |
Effects: Destroys the list.
All stored values are destroyed and used memory is deallocated.
Throws: Nothing.
Complexity: Linear to the number of elements.
|
inline |
Effects: Assigns the n copies of val to *this.
Throws: If memory allocation throws or T's copy constructor throws.
Complexity: Linear to n.
Referenced by boost::container::slist< T, Allocator >::assign(), and boost::container::slist< T, Allocator >::operator=().
|
inline |
Effects: Assigns the range [first, last) to *this.
Throws: If memory allocation throws or T's constructor from dereferencing InpIt throws.
Complexity: Linear to n.
References boost::container::slist< T, Allocator >::before_begin(), boost::container::slist< T, Allocator >::begin(), boost::container::slist< T, Allocator >::end(), boost::container::slist< T, Allocator >::erase_after(), boost::xpressive::first, and boost::container::slist< T, Allocator >::insert_after().
|
inline |
Effects: Assigns the range [il.begin(), il.end()) to *this.
Throws: If memory allocation throws or T's constructor from dereferencing std::initializer_list iterator throws.
Complexity: Linear to range [il.begin(), il.end()).
References boost::container::slist< T, Allocator >::assign().
|
inline |
Effects: Returns a non-dereferenceable iterator that, when incremented, yields begin().
This iterator may be used as the argument to insert_after, erase_after, etc.
Throws: Nothing.
Complexity: Constant.
References boost::container::slist< T, Allocator >::end().
Referenced by boost::container::slist< T, Allocator >::assign().
|
inline |
Effects: Returns a non-dereferenceable const_iterator that, when incremented, yields begin().
This iterator may be used as the argument to insert_after, erase_after, etc.
Throws: Nothing.
Complexity: Constant.
References boost::container::slist< T, Allocator >::cbefore_begin().
|
inline |
Effects: Returns an iterator to the first element contained in the list.
Throws: Nothing.
Complexity: Constant.
Referenced by boost::container::slist< T, Allocator >::assign(), boost::container::slist< T, Allocator >::cbegin(), boost::container::slist< T, Allocator >::front(), boost::container::slist< T, Allocator >::operator=(), and boost::container::slist< T, Allocator >::slist().
|
inline |
Effects: Returns a const_iterator to the first element contained in the list.
Throws: Nothing.
Complexity: Constant.
References boost::container::slist< T, Allocator >::cbegin().
typedef boost::container::slist< T, Allocator >::BOOST_CONTAINER_IMPDEF | ( | NodeAlloc | ) |
typedef boost::container::slist< T, Allocator >::BOOST_CONTAINER_IMPDEF | ( | iterator_impl | ) |
typedef boost::container::slist< T, Allocator >::BOOST_CONTAINER_IMPDEF | ( | const_iterator_impl | ) | const |
|
inline |
Effects: Returns a non-dereferenceable const_iterator that, when incremented, yields begin().
This iterator may be used as the argument to insert_after, erase_after, etc.
Throws: Nothing.
Complexity: Constant.
References boost::container::slist< T, Allocator >::end().
Referenced by boost::container::slist< T, Allocator >::before_begin(), and boost::container::slist< T, Allocator >::slist().
|
inline |
Effects: Returns a const_iterator to the first element contained in the list.
Throws: Nothing.
Complexity: Constant.
References boost::container::slist< T, Allocator >::begin().
Referenced by boost::container::slist< T, Allocator >::begin().
|
inline |
Effects: Returns a const_iterator to the end of the list.
Throws: Nothing.
Complexity: Constant.
References boost::container::slist< T, Allocator >::end().
Referenced by boost::container::slist< T, Allocator >::end().
|
inline |
Effects: Erases all the elements of the list.
Throws: Nothing.
Complexity: Linear to the number of elements in the list.
Referenced by boost::container::slist< T, Allocator >::operator=().
|
inline |
Effects: Returns true if the list contains no elements.
Throws: Nothing.
Complexity: Constant.
References boost::container::slist< T, Allocator >::size().
|
inline |
Effects: Returns an iterator to the end of the list.
Throws: Nothing.
Complexity: Constant.
Referenced by boost::container::slist< T, Allocator >::assign(), boost::container::slist< T, Allocator >::before_begin(), boost::container::slist< T, Allocator >::cbefore_begin(), boost::container::slist< T, Allocator >::cend(), boost::container::slist< T, Allocator >::operator=(), and boost::container::slist< T, Allocator >::slist().
|
inline |
Effects: Returns a const_iterator to the end of the list.
Throws: Nothing.
Complexity: Constant.
References boost::container::slist< T, Allocator >::cend().
|
inline |
Requires: p must be a valid iterator of *this.
Effects: Erases the element at p p.
Throws: Nothing.
Complexity: Linear to the number of elements before p.
References boost::container::slist< T, Allocator >::erase_after(), and boost::container::slist< T, Allocator >::previous().
|
inline |
Requires: first and last must be valid iterator to elements in *this.
Effects: Erases the elements pointed by [first, last).
Throws: Nothing.
Complexity: Linear to the distance between first and last plus linear to the elements before first.
References boost::container::slist< T, Allocator >::erase_after(), and boost::container::slist< T, Allocator >::previous().
|
inline |
Effects: Erases the element after the element pointed by prev_p of the list.
Returns: the first element remaining beyond the removed elements, or end() if no such element exists.
Throws: Nothing.
Complexity: Constant.
Note: Does not invalidate iterators or references to non erased elements.
Referenced by boost::container::slist< T, Allocator >::assign(), and boost::container::slist< T, Allocator >::erase().
|
inline |
Effects: Erases the range (before_first, last) from the list.
Returns: the first element remaining beyond the removed elements, or end() if no such element exists.
Throws: Nothing.
Complexity: Linear to the number of erased elements.
Note: Does not invalidate iterators or references to non erased elements.
|
inline |
Requires: !empty()
Effects: Returns a reference to the first element from the beginning of the container.
Throws: Nothing.
Complexity: Constant.
References boost::container::slist< T, Allocator >::begin().
|
inline |
Requires: !empty()
Effects: Returns a const reference to the first element from the beginning of the container.
Throws: Nothing.
Complexity: Constant.
References boost::container::slist< T, Allocator >::begin().
|
inline |
Effects: Returns a copy of the internal allocator.
Throws: If allocator's copy constructor throws.
Complexity: Constant.
|
inline |
Effects: Returns a reference to the internal allocator.
Throws: Nothing
Complexity: Constant.
Note: Non-standard extension.
|
inline |
Effects: Returns a reference to the internal allocator.
Throws: Nothing
Complexity: Constant.
Note: Non-standard extension.
|
inline |
Requires: p must be a valid iterator of *this.
Effects: Inserts n copies of x before p.
Returns: an iterator to the first inserted element or p if n == 0.
Throws: If memory allocation throws or T's copy constructor throws.
Complexity: Linear to n plus linear to the elements before p.
References boost::container::slist< T, Allocator >::insert_after(), and boost::container::slist< T, Allocator >::previous().
|
inline |
Requires: p must be a valid iterator of *this.
Effects: Insert a copy of the [first, last) range before p.
Returns: an iterator to the first inserted element or p if first == last.
Throws: If memory allocation throws, T's constructor from a dereferenced InpIt throws.
Complexity: Linear to std::distance [first, last) plus linear to the elements before p.
References boost::container::slist< T, Allocator >::insert_after(), and boost::container::slist< T, Allocator >::previous().
|
inline |
Requires: p must be a valid iterator of *this.
Effects: Insert a copy of the [il.begin(), il.end()) range before p.
Returns: an iterator to the first inserted element or p if il.begin() == il.end().
Throws: If memory allocation throws, T's constructor from a dereferenced std::initializer_list iterator throws.
Complexity: Linear to the range [il.begin(), il.end()) plus linear to the elements before p.
|
inline |
Requires: prev_p must be a valid iterator of *this.
Effects: Inserts n copies of x after prev_p.
Returns: an iterator to the last inserted element or prev_p if n is 0.
Throws: If memory allocation throws or T's copy constructor throws.
Complexity: Linear to n.
Note: Does not affect the validity of iterators and references of previous values.
Referenced by boost::container::slist< T, Allocator >::assign(), boost::container::slist< T, Allocator >::insert(), boost::container::slist< T, Allocator >::insert_after(), std::insert_iterator< boost::container::slist< T, Allocator > >::operator=(), boost::container::slist< T, Allocator >::resize(), and boost::container::slist< T, Allocator >::slist().
|
inline |
Requires: prev_p must be a valid iterator of *this.
Effects: Inserts the range pointed by [first, last) after prev_p.
Returns: an iterator to the last inserted element or prev_p if first == last.
Throws: If memory allocation throws, T's constructor from a dereferenced InpIt throws.
Complexity: Linear to the number of elements inserted.
Note: Does not affect the validity of iterators and references of previous values.
References boost::xpressive::first, boost::container::slist< T, Allocator >::insert_after(), and boost::last.
|
inline |
Requires: prev_p must be a valid iterator of *this.
Effects: Inserts the range pointed by [il.begin(), il.end()) after prev_p.
Returns: an iterator to the last inserted element or prev_p if il.begin() == il.end().
Throws: If memory allocation throws, T's constructor from a dereferenced std::initializer_list iterator throws.
Complexity: Linear to the number of elements inserted.
Note: Does not affect the validity of iterators and references of previous values.
|
inline |
|
inline |
Effects: Returns the largest possible size of the list.
Throws: Nothing.
Complexity: Constant.
|
inline |
Requires: The lists x and *this must be distinct.
Effects: 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.
Throws: If comparison throws.
Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.
Referenced by boost::container::slist< T, Allocator >::merge().
|
inline |
Requires: The lists x and *this must be distinct.
Effects: 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.
Throws: If comparison throws.
Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.
References boost::container::slist< T, Allocator >::merge().
|
inline |
Requires: 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.
Effects: 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.
Throws: If comp throws.
Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.
Note: Iterators and references to *this are not invalidated.
References BOOST_ASSERT.
|
inline |
Requires: 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.
Effects: 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.
Throws: If comp throws.
Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.
Note: Iterators and references to *this are not invalidated.
References boost::container::slist< T, Allocator >::merge().
|
inline |
Effects: Makes *this contain the same elements as x.
Postcondition: this->size() == x.size(). *this contains a copy of each of x's elements.
Throws: If memory allocation throws or T's copy constructor throws.
Complexity: Linear to the number of elements in x.
References boost::container::slist< T, Allocator >::assign(), boost::container::slist< T, Allocator >::begin(), boost::spirit::x3::bool_, boost::container::slist< T, Allocator >::clear(), boost::container::slist< T, Allocator >::end(), and boost::program_options::value().
|
inline |
Effects: Makes *this contain the same elements as x.
Postcondition: this->size() == x.size(). *this contains a copy of each of x's elements.
Throws: If allocator_traits_type::propagate_on_container_move_assignment is false and (allocation throws or value_type's move constructor throws)
Complexity: Constant if allocator_traits_type:: propagate_on_container_move_assignment is true or this->get>allocator() == x.get_allocator(). Linear otherwise.
References boost::container::slist< T, Allocator >::assign(), BOOST_ASSERT, boost::container::slist< T, Allocator >::clear(), boost::make_move_iterator(), boost::move(), boost::program_options::value(), and boost::detail::void.
|
inline |
|
inline |
Effects: Removes the first element from the list.
Throws: Nothing.
Complexity: Amortized constant time.
|
inline |
Returns: The iterator to the element before i in the sequence.
Returns the end-iterator, if either i is the begin-iterator or the sequence is empty.
Throws: Nothing.
Complexity: Linear to the number of elements before i.
Note: Non-standard extension.
References boost::multiprecision::backends::p.
Referenced by boost::container::slist< T, Allocator >::erase(), boost::container::slist< T, Allocator >::insert(), boost::container::slist< T, Allocator >::previous(), and boost::container::slist< T, Allocator >::splice().
|
inline |
Returns: The const_iterator to the element before i in the sequence.
Returns the end-const_iterator, if either i is the begin-const_iterator or the sequence is empty.
Throws: Nothing.
Complexity: Linear to the number of elements before i.
Note: Non-standard extension.
References boost::container::slist< T, Allocator >::previous().
|
inline |
Effects: Removes all the elements that compare equal to value.
Throws: Nothing.
Complexity: Linear time. It performs exactly size() comparisons for equality.
Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.
References boost::container::slist< T, Allocator >::remove_if(), and boost::program_options::value().
|
inline |
Effects: Removes all the elements for which a specified predicate is satisfied.
Throws: If pred throws.
Complexity: Linear time. It performs exactly size() calls to the predicate.
Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.
Referenced by boost::container::slist< T, Allocator >::remove().
|
inline |
Effects: Inserts or erases elements at the end such that the size becomes n.
New elements are value initialized.
Throws: If memory allocation throws, or T's copy constructor throws.
Complexity: Linear to the difference between size() and new_size.
References boost::container::slist< T, Allocator >::insert_after(), and boost::container::slist< T, Allocator >::size().
Referenced by boost::container::slist< T, Allocator >::slist().
|
inline |
Effects: Inserts or erases elements at the end such that the size becomes n.
New elements are copy constructed from x.
Throws: If memory allocation throws, or T's copy constructor throws.
Complexity: Linear to the difference between size() and new_size.
References boost::container::slist< T, Allocator >::insert_after().
|
inline |
Effects: Reverses the order of elements in the list.
Throws: Nothing.
Complexity: This function is linear time.
Note: Iterators and references are not invalidated
|
inline |
Effects: Returns the number of the elements contained in the list.
Throws: Nothing.
Complexity: Constant.
Referenced by boost::container::slist< T, Allocator >::empty(), boost::container::slist< T, Allocator >::resize(), and boost::container::slist< T, Allocator >::sort().
|
inline |
Effects: 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.
Throws: If comparison throws.
Notes: Iterators and references are not invalidated.
Complexity: The number of comparisons is approximately N log N, where N is the list's size.
|
inline |
Effects: 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.
Throws: If comp throws.
Notes: Iterators and references are not invalidated.
Complexity: The number of comparisons is approximately N log N, where N is the list's size.
References boost::container::slist< T, Allocator >::size().
|
inline |
Requires: p must point to an element contained by the list.
x != *this. this' allocator and x's allocator shall compare equal
Effects: Transfers all the elements of list x to this list, before the the element pointed by p. No destructors or copy constructors are called.
Throws: Nothing
Complexity: Linear in distance(begin(), p), and linear in x.size().
Note: 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.
References boost::container::slist< T, Allocator >::previous(), and boost::container::slist< T, Allocator >::splice_after().
Referenced by boost::container::slist< T, Allocator >::splice().
|
inline |
Requires: p must point to an element contained by the list.
x != *this. this' allocator and x's allocator shall compare equal
Effects: Transfers all the elements of list x to this list, before the the element pointed by p. No destructors or copy constructors are called.
Throws: Nothing
Complexity: Linear in distance(begin(), p), and linear in x.size().
Note: 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.
References boost::container::slist< T, Allocator >::splice().
|
inline |
Requires: 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
Effects: Transfers the value pointed by i, from list x to this list, before the the element pointed by p. No destructors or copy constructors are called. If p == i or p == ++i, this function is a null operation.
Throws: Nothing
Complexity: Linear in distance(begin(), p), and in distance(x.begin(), i).
Note: 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.
References boost::multiprecision::backends::i, boost::container::slist< T, Allocator >::previous(), and boost::container::slist< T, Allocator >::splice_after().
|
inline |
Requires: 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.
Effects: Transfers the value pointed by i, from list x to this list, before the the element pointed by p. No destructors or copy constructors are called. If p == i or p == ++i, this function is a null operation.
Throws: Nothing
Complexity: Linear in distance(begin(), p), and in distance(x.begin(), i).
Note: 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.
References boost::multiprecision::backends::i, and boost::container::slist< T, Allocator >::splice().
|
inline |
Requires: p must point to an element contained by this list.
first and last must point to elements contained in list x.
Effects: Transfers the range pointed by first and last from list x to this list, before the the element pointed by p. No destructors or copy constructors are called. this' allocator and x's allocator shall compare equal.
Throws: Nothing
Complexity: Linear in distance(begin(), p), in distance(x.begin(), first), and in distance(first, last).
Note: 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.
References boost::container::slist< T, Allocator >::previous(), and boost::container::slist< T, Allocator >::splice_after().
|
inline |
Requires: 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
Effects: Transfers the range pointed by first and last from list x to this list, before the the element pointed by p. No destructors or copy constructors are called.
Throws: Nothing
Complexity: Linear in distance(begin(), p), in distance(x.begin(), first), and in distance(first, last).
Note: 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.
References boost::container::slist< T, Allocator >::splice().
|
inline |
Requires: p must point to an element contained by the list.
x != *this
Effects: Transfers all the elements of list x to this list, after the the element pointed by p. No destructors or copy constructors are called.
Throws: std::runtime_error if this' allocator and x's allocator are not equal.
Complexity: Linear to the elements in x.
Note: 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.
References BOOST_ASSERT.
Referenced by boost::container::slist< T, Allocator >::splice(), and boost::container::slist< T, Allocator >::splice_after().
|
inline |
Requires: p must point to an element contained by the list.
x != *this
Effects: Transfers all the elements of list x to this list, after the the element pointed by p. No destructors or copy constructors are called.
Throws: std::runtime_error if this' allocator and x's allocator are not equal.
Complexity: Linear to the elements in x.
Note: 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.
References boost::container::slist< T, Allocator >::splice_after().
|
inline |
Requires: 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.
Effects: 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.
Throws: Nothing
Complexity: Constant.
Note: 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.
References BOOST_ASSERT.
|
inline |
Requires: 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.
Effects: 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.
Throws: Nothing
Complexity: Constant.
Note: 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.
References boost::container::slist< T, Allocator >::splice_after().
|
inline |
Requires: 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.
Effects: Transfers the range [before_first + 1, before_last + 1) from list x to this list, after the element pointed by prev_p.
Throws: Nothing
Complexity: Linear to the number of transferred elements.
Note: 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.
References BOOST_ASSERT.
|
inline |
Requires: 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.
Effects: Transfers the range [before_first + 1, before_last + 1) from list x to this list, after the element pointed by prev_p.
Throws: Nothing
Complexity: Linear to the number of transferred elements.
Note: 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.
References boost::container::slist< T, Allocator >::splice_after().
|
inline |
Requires: 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 == std::distance(before_first, before_last). this' allocator and x's allocator shall compare equal.
Effects: Transfers the range [before_first + 1, before_last + 1) from list x to this list, after the element pointed by prev_p.
Throws: Nothing
Complexity: Constant.
Note: 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.
References BOOST_ASSERT, and boost::n.
|
inline |
Requires: 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 == std::distance(before_first, before_last). this' allocator and x's allocator shall compare equal.
Effects: Transfers the range [before_first + 1, before_last + 1) from list x to this list, after the element pointed by prev_p.
Throws: Nothing
Complexity: Constant.
Note: 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.
References boost::container::slist< T, Allocator >::splice_after().
|
inline |
Effects: Swaps the contents of *this and x.
Throws: Nothing.
Complexity: Linear to the number of elements on *this and x.
References boost::intrusive::swap().
|
inline |
Effects: Removes adjacent duplicate elements or adjacent elements that are equal from the list.
Throws: If comparison throws.
Complexity: Linear time (size()-1 comparisons equality comparisons).
Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.
|
inline |
Effects: Removes adjacent duplicate elements or adjacent elements that satisfy some binary predicate from the list.
Throws: If pred throws.
Complexity: Linear time (size()-1 comparisons calls to pred()).
Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.
|
friend |
Referenced by boost::container::slist< T, Allocator >::insert_after().
|
friend |
Effects: Returns true if x and y are unequal
Complexity: Linear to the number of elements in the container.
|
friend |
Effects: Returns true if x is less than y
Complexity: Linear to the number of elements in the container.
|
friend |
Effects: Returns true if x is equal or less than y
Complexity: Linear to the number of elements in the container.
|
friend |
Effects: Returns true if x and y are equal
Complexity: Linear to the number of elements in the container.
|
friend |
Effects: Returns true if x is greater than y
Complexity: Linear to the number of elements in the container.
|
friend |
Effects: Returns true if x is equal or greater than y
Complexity: Linear to the number of elements in the container.
|
friend |
Effects: x.swap(y)
Complexity: Constant.