-
allocator_type get_allocator() const;
Effects: Returns a copy of the internal allocator.
Throws: If allocator's copy constructor throws.
Complexity: Constant.
const stored_allocator_type & get_stored_allocator() const;
stored_allocator_type & get_stored_allocator() ;
-
void clear() ;
Effects: Erases all the elements of the list.
Throws: Nothing.
Complexity: Linear to the number of elements in the list.
-
iterator begin() ;
Effects: Returns an iterator to the first element contained in the list.
Throws: Nothing.
Complexity: Constant.
-
const_iterator begin() const;
Effects: Returns a const_iterator to the first element contained in the list.
Throws: Nothing.
Complexity: Constant.
-
iterator end() ;
Effects: Returns an iterator to the end of the list.
Throws: Nothing.
Complexity: Constant.
-
const_iterator end() const;
Effects: Returns a const_iterator to the end of the list.
Throws: Nothing.
Complexity: Constant.
-
reverse_iterator rbegin() ;
Effects: Returns a reverse_iterator pointing to the beginning of the reversed list.
Throws: Nothing.
Complexity: Constant.
-
const_reverse_iterator rbegin() const;
Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed list.
Throws: Nothing.
Complexity: Constant.
-
reverse_iterator rend() ;
Effects: Returns a reverse_iterator pointing to the end of the reversed list.
Throws: Nothing.
Complexity: Constant.
-
const_reverse_iterator rend() const;
Effects: Returns a const_reverse_iterator pointing to the end of the reversed list.
Throws: Nothing.
Complexity: Constant.
-
bool empty() const;
Effects: Returns true if the list contains no elements.
Throws: Nothing.
Complexity: Constant.
-
size_type size() const;
Effects: Returns the number of the elements contained in the list.
Throws: Nothing.
Complexity: Constant.
-
size_type max_size() const;
Effects: Returns the largest possible size of the list.
Throws: Nothing.
Complexity: Constant.
-
void push_front(const T & x) ;
Effects: Inserts a copy of t in the beginning of the list.
Throws: If memory allocation throws or T's copy constructor throws.
Complexity: Amortized constant time.
-
void push_front(unspecified x) ;
Effects: Constructs a new element in the beginning of the list and moves the resources of t to this new element.
Throws: If memory allocation throws.
Complexity: Amortized constant time.
-
void push_back(const T & x) ;
Effects: Removes the last element from the list.
Throws: Nothing.
Complexity: Amortized constant time.
-
void push_back(unspecified x) ;
Effects: Removes the first element from the list.
Throws: Nothing.
Complexity: Amortized constant time.
-
void pop_front() ;
Effects: Removes the first element from the list.
Throws: Nothing.
Complexity: Amortized constant time.
-
void pop_back() ;
Effects: Removes the last element from the list.
Throws: Nothing.
Complexity: Amortized constant time.
-
reference front() ;
Requires: !empty()
Effects: Returns a reference to the first element from the beginning of the container.
Throws: Nothing.
Complexity: Constant.
-
const_reference front() const;
Requires: !empty()
Effects: Returns a const reference to the first element from the beginning of the container.
Throws: Nothing.
Complexity: Constant.
-
reference back() ;
Requires: !empty()
Effects: Returns a reference to the first element from the beginning of the container.
Throws: Nothing.
Complexity: Constant.
-
const_reference back() const;
Requires: !empty()
Effects: Returns a const reference to the first element from the beginning of the container.
Throws: Nothing.
Complexity: Constant.
-
void resize(size_type new_size, const T & x) ;
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.
-
void resize(size_type new_size) ;
Effects: Inserts or erases elements at the end such that the size becomes n. New elements are default constructed.
Throws: If memory allocation throws, or T's copy constructor throws.
Complexity: Linear to the difference between size() and new_size.
-
void swap(ThisType & x) ;
Effects: Swaps the contents of *this and x. If this->allocator_type() != x.allocator_type() allocators are also swapped.
Throws: Nothing.
Complexity: Constant.
-
void insert(iterator p, size_type n, const T & x) ;
Requires: p must be a valid iterator of *this.
Effects: Inserts n copies of x before p.
Throws: If memory allocation throws or T's copy constructor throws.
Complexity: Linear to n.
-
template<typename InpIt> void insert(iterator p, InpIt first, InpIt last) ;
Requires: p must be a valid iterator of *this.
Effects: Insert a copy of the [first, last) range before p.
Throws: If memory allocation throws, T's constructor from a dereferenced InpIt throws.
Complexity: Linear to std::distance [first, last).
-
iterator insert(iterator p, const T & x) ;
Requires: p must be a valid iterator of *this.
Effects: Insert a copy of x before p.
Throws: If memory allocation throws or x's copy constructor throws.
Complexity: Amortized constant time.
-
iterator insert(iterator p, unspecified x) ;
Requires: p must be a valid iterator of *this.
Effects: Insert a new element before p with mx's resources.
Throws: If memory allocation throws.
Complexity: Amortized constant time.
-
iterator erase(iterator p) ;
Requires: p must be a valid iterator of *this.
Effects: Erases the element at p p.
Throws: Nothing.
Complexity: Amortized constant time.
-
iterator erase(iterator first, iterator last) ;
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.
-
void assign(size_type n, const T & val) ;
Effects: Assigns the n copies of val to *this.
Throws: If memory allocation throws or T's copy constructor throws.
Complexity: Linear to n.
-
template<typename InpIt> void assign(InpIt first, InpIt last) ;
Effects: Assigns the the range [first, last) to *this.
Throws: If memory allocation throws or T's constructor from dereferencing InpIt throws.
Complexity: Linear to n.
-
void splice(iterator p, ThisType & x) ;
Requires: p must point to an element contained by the list. x != *this
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: std::runtime_error if this' allocator and x's allocator are not equal.
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.
-
void splice(iterator p, ThisType & x, iterator i) ;
Requires: p must point to an element contained by this list. i must point to an element contained in list x.
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: std::runtime_error if this' allocator and x's allocator are not equal.
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.
-
void splice(iterator p, ThisType & x, iterator first, iterator last) ;
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.
Throws: std::runtime_error if this' allocator and x's allocator are not equal.
Complexity: Linear to the number of elements transferred.
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.
-
void splice(iterator p, ThisType & x, iterator first, iterator last,
size_type n) ;
Requires: p must point to an element contained by this list. first and last must point to elements contained in list x. n == std::distance(first, last)
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: std::runtime_error if this' allocator and x's allocator are not equal.
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.
-
void reverse() ;
Effects: Reverses the order of elements in the list.
Throws: Nothing.
Complexity: This function is linear time.
Note: Iterators and references are not invalidated
-
void remove(const T & value) ;
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.
-
template<typename Pred> void remove_if(Pred pred) ;
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.
-
void unique() ;
Effects: Removes adjacent duplicate elements or adjacent elements that are equal from the list.
Throws: Nothing.
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.
-
template<typename BinaryPredicate> void unique(BinaryPredicate binary_pred) ;
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 equality comparisons).
Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.
-
void merge(list< T, A > & x) ;
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: Nothing.
Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.
-
template<typename StrictWeakOrdering>
void merge(list< T, A > & x, StrictWeakOrdering comp) ;
Effects: This function removes all of moved mx'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: Nothing.
Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.
Note: Iterators and references to *this are not invalidated. 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: Nothing.
Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.
Note: Iterators and references to *this are not invalidated.
-
void sort() ;
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 moved mx'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: Nothing.
Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.
Note: Iterators and references to *this are not invalidated. 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: Nothing.
Notes: Iterators and references are not invalidated.
Complexity: The number of comparisons is approximately N log N, where N is the list's size.
-
template<typename StrictWeakOrdering> void sort(StrictWeakOrdering comp) ;
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: Nothing.
Notes: Iterators and references are not invalidated.
Complexity: The number of comparisons is approximately N log N, where N is the list's size.