Library of Assembled Shared Sources
|
a single linked list, just like the one in SGI STL (and STLport ...) More...
#include <slist.h>
Public Member Functions | |
slist (const Alloc &allocator=Alloc()) | |
Creates an empty list, using the provided allocator. | |
slist (size_type n, const T &value=T(), const Alloc &allocator=Alloc()) | |
Creates an list with n elements - each of which is a copy of value - and an allocator. | |
template<typename InputIterator> | |
slist (InputIterator first, InputIterator last, const Alloc &allocator=Alloc()) | |
creates a list with as elements a copy of a range, and an allocator. | |
slist (const slist< T, Alloc > &other) | |
copies an entire list and its elements and allocator. | |
~slist () | |
destroys all elements and frees memory. | |
slist< T, Alloc > & | operator= (slist< T, Alloc > other) |
replace *this by a copy of other. | |
void | assign (size_type n, const T &value=T()) |
replace *this by a list with n copies of value | |
allocator_type | get_allocator () const |
returns the memory model of the list. | |
iterator | begin () |
returns an iterator to the first element of the list. | |
const_iterator | begin () const |
returns an iterator to the first element of the list. | |
iterator | end () |
returns an iterator for the position after the last element of the list. | |
const_iterator | end () const |
returns an iterator for the position after the last element of the list. | |
iterator | before_begin () |
returns an iterator for the position before the first element of the list. | |
const_iterator | before_begin () const |
returns an iterator for the position before the first element of the list. | |
iterator | prior (iterator position) const |
return the iterator that sits position and start searching for it from start. | |
const_iterator | prior (const_iterator position) const |
return the iterator that sits position and start searching for it from start. | |
iterator | prior (iterator position, iterator start) const |
return the iterator that sits position and start searching for it from start. | |
const_iterator | prior (const_iterator position, const_iterator start) const |
return the iterator that sits position and start searching for it from start. | |
bool | empty () const |
returns wether the list is empty. | |
size_type | size () const |
returns the N, the number of elements in the list. | |
size_type | max_size () const |
returns a very rough estimation on what's the maximum number of elements you can ever have in an slist . | |
void | resize (size_type n, const T &value=T()) |
at the end of the list, inserts copies of value or erases elements so that list size is n. | |
reference | front () |
returns reference to first element in list. | |
const_reference | front () const |
returns reference to first element in list. | |
void | push_front (const T &value) |
insert a copy of value at the front of the list so that the current list comes behind it. | |
void | pop_front () |
erases the first element in the list. | |
iterator | insert (iterator position, const T &value) |
inserts a new element before iterator position and returns iterator to it. | |
void | insert (iterator position, size_type n, const T &value) |
inserts n copies of value before iterator position. | |
template<typename InputIterator> | |
void | insert (iterator position, InputIterator first, InputIterator last) |
inserts a copy of a range before iterator position. | |
iterator | insert_after (iterator position, const T &value) |
inserts a new element after iterator position and returns iterator to it. | |
void | insert_after (iterator position, size_type n, const T &value) |
inserts n copies of value after iterator position. | |
template<typename InputIterator> | |
void | insert_after (iterator position, InputIterator first, InputIterator last) |
inserts a copy of a range before iterator position. | |
iterator | erase (iterator position) |
removes element at iterator position from the list and return iterator to the next element. | |
iterator | erase (iterator position, iterator last) |
removes element in range from the list and return iterator to the next element. | |
void | erase_after (iterator position) |
removes element after iterator position from the list. | |
void | erase_after (iterator position, iterator last) |
removes element in range from the list and return iterator to the next element. | |
void | swap (slist< T, Alloc > &other) |
exchange all data between two lists. | |
void | clear () |
removes all elements from the list | |
void | splice (iterator position, slist< T, Alloc > &other) |
moves all elements from other to *this before position without copying, and clears other. | |
void | splice (iterator position, slist< T, Alloc > &other, iterator x) |
moves x from other to *this before position without copying. | |
void | splice (iterator position, slist< T, Alloc > &other, iterator first, iterator last) |
moves [ first , last ) from other to *this before position without copying. | |
void | splice_after (iterator position, slist< T, Alloc > &other) |
moves all elements from other to *this after position without copying, and clears other. | |
void | splice_after (iterator position, slist< T, Alloc > &other, iterator before_x) |
moves element before before_x from other to *this after position without copying. | |
void | splice_after (iterator position, slist< T, Alloc > &other, iterator before_first, iterator before_last) |
moves ( before_first, before_last ] from other to *this after position without copying. | |
void | remove (const T &value) |
removes all elements with iterarors i for which *i == value | |
template<class UnaryPredicate> | |
void | remove_if (UnaryPredicate predicate) |
removes all elements with iterarors i for which predicate(*i) yields true . | |
void | unique () |
removes all but the first element in every consecutive group of equal elements. | |
template<class BinaryPredicate> | |
void | unique (BinaryPredicate predicate) |
removes all but the first element in every consecutive group of equivalent elements by a predicate. | |
void | merge (slist< T, Alloc > &other) |
Merge two sorted containers to one big sorted. | |
template<class BinaryPredicate> | |
void | merge (slist< T, Alloc > &other, BinaryPredicate compare) |
Merge two by compare sorted containers to one big sorted. | |
void | sort () |
Sorts *this according to operator< . | |
void | reverse () |
reverses the order of the elements. | |
template<typename ForwardIterator> | |
void | assign (ForwardIterator first, ForwardIterator last) |
replace *this by a list copied from a range. | |
template<class BinaryPredicate> | |
void | sort (BinaryPredicate compare) |
Sorts *this according to compare. | |
Related Symbols | |
(Note that these are not member symbols.) | |
template<typename T, class Alloc> | |
bool | operator== (const slist< T, Alloc > &a, const slist< T, Alloc > &b) |
returns wether a and b are lexicographical idential. | |
template<typename T, class Alloc> | |
bool | operator!= (const slist< T, Alloc > &a, const slist< T, Alloc > &b) |
returns wether a and b are not lexicographical idential. | |
template<typename T, class Alloc> | |
bool | operator< (const slist< T, Alloc > &a, const slist< T, Alloc > &b) |
returns wether a is lexicographical less than b. | |
template<typename T, class Alloc> | |
bool | operator> (const slist< T, Alloc > &a, const slist< T, Alloc > &b) |
returns wether b is lexicographical less than a. | |
template<typename T, class Alloc> | |
bool | operator<= (const slist< T, Alloc > &a, const slist< T, Alloc > &b) |
returns wether a is lexicographical less or equal to b. | |
template<typename T, class Alloc> | |
bool | operator>= (const slist< T, Alloc > &a, const slist< T, Alloc > &b) |
returns wether b is lexicographical less or equal to a. | |
template<typename T, class Alloc, typename Char, typename Traits> | |
std::basic_ostream< Char, Traits > & | operator<< (std::basic_ostream< Char, Traits > &ostream, const slist< T, Alloc > &container) |
writes list to output stream. | |
template<typename T, class Alloc, typename Char, typename Traits> | |
std::basic_istream< Char, Traits > & | operator>> (std::basic_istream< Char, Traits > &istream, slist< T, Alloc > &container) |
reads list from stream. | |
a single linked list, just like the one in SGI STL (and STLport ...)
|
explicit |
Creates an empty list, using the provided allocator.
allocator | to be used as memory model, defaults to Alloc() . |
complexity: O(1)
Definition at line 82 of file slist.inl.
Referenced by clear(), merge(), merge(), prior(), slist(), splice(), splice(), splice(), splice_after(), splice_after(), splice_after(), and swap().
|
explicit |
Creates an list with n elements - each of which is a copy of value - and an allocator.
n | is the number of copies of value to put in the list. |
value | will be used to copy construct all of the n elements of the list, defaults to T() . |
allocator | to be used as memory model, defaults to Alloc() . |
complexity: O(N) with N = n.
Definition at line 100 of file slist.inl.
References before_begin(), and insert_after().
lass::stde::slist< T, Alloc >::slist | ( | InputIterator | first, |
InputIterator | last, | ||
const Alloc & | allocator = Alloc() ) |
creates a list with as elements a copy of a range, and an allocator.
first | iterator to first element of range to be copied in list. |
last | iterator to position after the last element to be copied in list. last must be forward reachable from first. |
allocator | to be used as memory model, defaults to Alloc() . |
complexity: O(N) with N = std::distance(first, last)
.
Definition at line 120 of file slist.inl.
References before_begin(), and insert_after().
lass::stde::slist< T, Alloc >::slist | ( | const slist< T, Alloc > & | other | ) |
copies an entire list and its elements and allocator.
other | the list to be copied |
complexity: O(N) with N = other.size()
Definition at line 136 of file slist.inl.
References before_begin(), begin(), end(), get_allocator(), insert_after(), and slist().
lass::stde::slist< T, Alloc >::~slist | ( | ) |
slist< T, Alloc > & lass::stde::slist< T, Alloc >::operator= | ( | slist< T, Alloc > | other | ) |
void lass::stde::slist< T, Alloc >::assign | ( | size_type | n, |
const T & | value = T() ) |
slist< T, Alloc >::allocator_type lass::stde::slist< T, Alloc >::get_allocator | ( | ) | const |
slist< T, Alloc >::iterator lass::stde::slist< T, Alloc >::begin | ( | ) |
returns an iterator to the first element of the list.
complexity: O(1)
Definition at line 229 of file slist.inl.
Referenced by lass::stde::value_type< T, Alloc >::operator<(), lass::stde::value_type< T, Alloc >::operator==(), reverse(), and slist().
slist< T, Alloc >::const_iterator lass::stde::slist< T, Alloc >::begin | ( | ) | const |
slist< T, Alloc >::iterator lass::stde::slist< T, Alloc >::end | ( | ) |
returns an iterator for the position after the last element of the list.
complexity: O(1)
Definition at line 255 of file slist.inl.
Referenced by lass::stde::value_type< T, Alloc >::operator<(), lass::stde::value_type< T, Alloc >::operator==(), and slist().
slist< T, Alloc >::const_iterator lass::stde::slist< T, Alloc >::end | ( | ) | const |
slist< T, Alloc >::iterator lass::stde::slist< T, Alloc >::before_begin | ( | ) |
returns an iterator for the position before the first element of the list.
This iterator is not dereferencable! It's only an iterator for which the next one is this->begin()
. Use this one in methods like insert_after
and erase_after
when you want the method to affect on the first element in the list. Using begin()
would fail for this purpose the element after this->begin()
is already the second in the list.
complexity: O(1)
Definition at line 285 of file slist.inl.
Referenced by prior(), prior(), slist(), slist(), and slist().
slist< T, Alloc >::const_iterator lass::stde::slist< T, Alloc >::before_begin | ( | ) | const |
returns an iterator for the position before the first element of the list.
This iterator is not dereferencable! It's only an iterator for which the next one is this->begin()
. Use this one in methods like insert_after
and erase_after
when you want the method to affect on the first element in the list. Using begin()
would fail for this purpose the element after this->begin()
is already the second in the list.
complexity: O(1)
slist< T, Alloc >::iterator lass::stde::slist< T, Alloc >::prior | ( | iterator | position | ) | const |
return the iterator that sits position and start searching for it from start.
Equivalent to this->prior(position, this->before_begin())
.
position | must be valid in *this and should not be this->before_begin() |
complexity: O(N) with N = std::distance(this->begin(), position)
Definition at line 318 of file slist.inl.
References before_begin(), prior(), and slist().
Referenced by erase(), erase(), insert(), insert(), insert(), prior(), prior(), splice(), splice(), and splice().
slist< T, Alloc >::const_iterator lass::stde::slist< T, Alloc >::prior | ( | const_iterator | position | ) | const |
return the iterator that sits position and start searching for it from start.
Equivalent to this->prior(position, this->before_begin())
.
position | must be valid in *this and should not be this->before_begin() |
complexity: O(N) with N = std::distance(this->begin(), position)
Definition at line 334 of file slist.inl.
References before_begin(), and prior().
slist< T, Alloc >::iterator lass::stde::slist< T, Alloc >::prior | ( | iterator | position, |
iterator | start ) const |
return the iterator that sits position and start searching for it from start.
The method scans linearly all iterators from start until it find the one for which the next one is position. It returns the same result as std::prior(position)
would have returned if the iterator had support for the decrement operation.
position | must be valid in *this and should not be this->before_begin() |
start | must be a valid iterator in [this->begin(),position) |
complexity: O(N) with N = std::distance(start, position)
slist< T, Alloc >::const_iterator lass::stde::slist< T, Alloc >::prior | ( | const_iterator | position, |
const_iterator | start ) const |
return the iterator that sits position and start searching for it from start.
The method scans linearly all iterators from start until it find the one for which the next one is position. It returns the same result as std::prior(position)
would have returned if the iterator had support for the decrement operation.
position | must be valid in *this and should not be this->before_begin() |
start | must be a valid iterator in [this->begin(),position) |
complexity: O(N) with N = std::distance(start, position)
bool lass::stde::slist< T, Alloc >::empty | ( | ) | const |
slist< T, Alloc >::size_type lass::stde::slist< T, Alloc >::size | ( | ) | const |
returns the N, the number of elements in the list.
complexity: O(N) with N = this->size()
.
Definition at line 411 of file slist.inl.
Referenced by lass::stde::split().
slist< T, Alloc >::size_type lass::stde::slist< T, Alloc >::max_size | ( | ) | const |
void lass::stde::slist< T, Alloc >::resize | ( | size_type | n, |
const T & | value = T() ) |
at the end of the list, inserts copies of value or erases elements so that list size is n.
n | the size of the list after inserting or erasing elements. |
value | if the list must grow, copies of value are inserted at the end. Defaults to T(). |
complexity: O(N) with N = n.
Definition at line 450 of file slist.inl.
References insert_after().
slist< T, Alloc >::reference lass::stde::slist< T, Alloc >::front | ( | ) |
slist< T, Alloc >::const_reference lass::stde::slist< T, Alloc >::front | ( | ) | const |
void lass::stde::slist< T, Alloc >::push_front | ( | const T & | value | ) |
void lass::stde::slist< T, Alloc >::pop_front | ( | ) |
slist< T, Alloc >::iterator lass::stde::slist< T, Alloc >::insert | ( | iterator | position, |
const T & | value ) |
inserts a new element before iterator position and returns iterator to it.
position | must be valid in *this and should not be this->before_begin() |
value | to be inserted |
prior(position)
. Try to use insert_after
whenever you can.All iterators stay valid.
complexity: O(N) with N = std::distance(this->begin(), position)
Definition at line 553 of file slist.inl.
References insert_after(), and prior().
void lass::stde::slist< T, Alloc >::insert | ( | iterator | position, |
size_type | n, | ||
const T & | value ) |
inserts n copies of value before iterator position.
position | must be valid in *this and should not be this->before_begin() |
n | number of copies to be inserted. |
value | to be inserted |
prior(position)
. Try to use insert_after
whenever you can.All iterators stay valid.
complexity: O(N1) + O(N2) with N1 = std::distance(this->begin(), position)
and N2 = n.
Definition at line 576 of file slist.inl.
References insert_after(), and prior().
void lass::stde::slist< T, Alloc >::insert | ( | iterator | position, |
InputIterator | first, | ||
InputIterator | last ) |
inserts a copy of a range before iterator position.
position | must be valid in *this and should not be this->before_begin() |
first | iterator to first element to be inserted. |
last | iterator to position after last element to be insert. Must be forward reachable from first. |
prior(position)
. Try to use insert_after
whenever you can.All iterators stay valid.
complexity: O(N1) + O(N2) with N1 = std::distance(this->begin(), position)
and N2 = std::distance(first, last)
Definition at line 601 of file slist.inl.
References insert_after(), and prior().
slist< T, Alloc >::iterator lass::stde::slist< T, Alloc >::insert_after | ( | iterator | position, |
const T & | value ) |
inserts a new element after iterator position and returns iterator to it.
position | must be valid in *this and should not be this->end() |
value | to be inserted |
All iterators stay valid.
complexity: O(1)
Definition at line 620 of file slist.inl.
Referenced by insert(), insert(), insert(), insert_after(), resize(), slist(), slist(), and slist().
void lass::stde::slist< T, Alloc >::insert_after | ( | iterator | position, |
size_type | n, | ||
const T & | value ) |
void lass::stde::slist< T, Alloc >::insert_after | ( | iterator | position, |
InputIterator | first, | ||
InputIterator | last ) |
inserts a copy of a range before iterator position.
position | must be valid in *this and should not be this->end() |
first | iterator to first element to be inserted. |
last | iterator to position after last element to be insert. Must be forward reachable from first. |
All iterators stay valid.
complexity: O(N) with N = std::distance(first, last)
.
Definition at line 666 of file slist.inl.
References insert_after().
slist< T, Alloc >::iterator lass::stde::slist< T, Alloc >::erase | ( | iterator | position | ) |
removes element at iterator position from the list and return iterator to the next element.
position | element to be erased. Must be valid in *this and should not be this->before_begin() or this->end() . |
prior(position)
. Try to use erase_after
whenever you can.All iterators except position stay valid.
complexity: O(N) with N = std::distance(this->begin(), position)
Definition at line 687 of file slist.inl.
References erase_after(), and prior().
slist< T, Alloc >::iterator lass::stde::slist< T, Alloc >::erase | ( | iterator | position, |
iterator | last ) |
removes element in range from the list and return iterator to the next element.
position | iterator to first element to be erased. Must be valid in *this and should not be this->before_begin() or this->end() . |
last | iterator to position behind last element to be erased, must be valid in *this and forward reachable from position. |
prior(position)
. Try to use erase_after
whenever you can.All iterators except these in range [ position, last ) stay valid.
complexity: O(N1) + O(N2) with N1 = std::distance(this->begin(), position)
and N2 = std::distance(position, last)
Definition at line 713 of file slist.inl.
References erase_after(), and prior().
void lass::stde::slist< T, Alloc >::erase_after | ( | iterator | position | ) |
removes element after iterator position from the list.
position | iterator to position before element to be erased, must be valid in *this , and should not be this->end() |
All iterators except the one after position stay valid.
complexity: O(1)
Definition at line 732 of file slist.inl.
Referenced by erase(), erase(), and erase_after().
void lass::stde::slist< T, Alloc >::erase_after | ( | iterator | position, |
iterator | last ) |
removes element in range from the list and return iterator to the next element.
position | iterator to position before first element to be erased. Must be valid in *this and should not be this->end() |
last | iterator to position behind last element to be erased, must be valid in *this and forward reachable from position. |
All iterators except these in range ( position, last ) stay valid.
complexity: O(N) with N = std::distance(position, last)
Definition at line 752 of file slist.inl.
References erase_after().
void lass::stde::slist< T, Alloc >::swap | ( | slist< T, Alloc > & | other | ) |
exchange all data between two lists.
All iterators stay valid.
complexity: O(1)
Definition at line 770 of file slist.inl.
References get_allocator(), and slist().
Referenced by clear(), and lass::stde::value_type< T, Alloc >::sort().
void lass::stde::slist< T, Alloc >::clear | ( | ) |
void lass::stde::slist< T, Alloc >::splice | ( | iterator | position, |
slist< T, Alloc > & | other ) |
moves all elements from other to *this
before position without copying, and clears other.
position | must be valid in *this and should not be this->before_begin() |
other | must not be the same as *this (&other != this ). |
prior(position)
. Try to use splice_after
whenever you can.All iterators stay valid.
complexity: O(N1) + O(N2) with N1 = std::distance(this->begin(), position)
and N2 = other.size()
Definition at line 806 of file slist.inl.
References prior(), slist(), and splice_after().
void lass::stde::slist< T, Alloc >::splice | ( | iterator | position, |
slist< T, Alloc > & | other, | ||
iterator | x ) |
moves x from other to *this
before position without copying.
position | must be valid in *this and should not be this->before_begin() |
other | may be the same as *this . |
x | must be valid in other and should not be other.before_begin() |
prior(position)
and prior(x)
. Try to use splice_after
whenever you can.All iterators stay valid.
complexity: O(N1) + O(N2) with N1 = std::distance(this->begin(), position)
and N2 = std::distance(other.begin(), x)
Definition at line 829 of file slist.inl.
References prior(), slist(), and splice_after().
void lass::stde::slist< T, Alloc >::splice | ( | iterator | position, |
slist< T, Alloc > & | other, | ||
iterator | first, | ||
iterator | last ) |
moves [ first , last ) from other to *this
before position without copying.
position | must be valid in *this and should not be this->before_begin() . position should not be an element of [ first , last ). |
other | may be the same as *this . |
first | must be valid in other and should not be other.before_begin() |
last | must be valid in other and should be forward reachable from first. |
prior(position)
and prior(x)
. Try to use splice_after
whenever you can.All iterators stay valid.
complexity: O(N1) + O(N2) with N1 = std::distance(this->begin(), position)
and N2 = std::distance(other.begin(), x)
Definition at line 855 of file slist.inl.
References prior(), slist(), and splice_after().
void lass::stde::slist< T, Alloc >::splice_after | ( | iterator | position, |
slist< T, Alloc > & | other ) |
moves all elements from other to *this
after position without copying, and clears other.
position | must be valid in *this and should not be this->end() |
other | must not be the same as *this (&other != this ). |
All iterators stay valid.
complexity: O(N) with N = other.size()
Definition at line 876 of file slist.inl.
References slist(), and splice_after().
Referenced by merge(), splice(), splice(), splice(), splice_after(), splice_after(), and splice_after().
void lass::stde::slist< T, Alloc >::splice_after | ( | iterator | position, |
slist< T, Alloc > & | other, | ||
iterator | before_x ) |
moves element before before_x from other to *this
after position without copying.
position | must be valid in *this and should not be this->end() |
other | may be the same as *this . |
before_x | must be valid in other and should not be other.end() |
All iterators stay valid.
complexity: O(1)
Definition at line 900 of file slist.inl.
References slist(), and splice_after().
void lass::stde::slist< T, Alloc >::splice_after | ( | iterator | position, |
slist< T, Alloc > & | other, | ||
iterator | before_first, | ||
iterator | before_last ) |
moves ( before_first, before_last ] from other to *this
after position without copying.
position | must be valid in *this and should not be this->end() . position should not be an element of ( before_first, before_last ]. |
other | may be the same as *this . |
before_first | must be valid in other and should not be other.end() |
before_last | must be valid in other and should be forward reachable from before_first. |
All iterators stay valid.
complexity: O(1)
Definition at line 920 of file slist.inl.
References slist(), and splice_after().
void lass::stde::slist< T, Alloc >::remove | ( | const T & | value | ) |
void lass::stde::slist< T, Alloc >::remove_if | ( | UnaryPredicate | predicate | ) |
void lass::stde::slist< T, Alloc >::unique | ( | ) |
void lass::stde::slist< T, Alloc >::unique | ( | BinaryPredicate | predicate | ) |
removes all but the first element in every consecutive group of equivalent elements by a predicate.
predicate | two elements *i and *j are considered equivalent if predicate(*i, *j) is true. |
The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.
complexity: O(N) with N = this->size()
void lass::stde::slist< T, Alloc >::merge | ( | slist< T, Alloc > & | other | ) |
Merge two sorted containers to one big sorted.
Both *this
and other must be sorted according to operator<
, and they must be distinct (&other != this
). This function removes all of other'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 other, then the element from *this
will precede the one from other. All iterators to elements in *this
and other remain valid.
other | the other sorted slist |
complexity: O(N1) + O(N2) with N1 = this->size()
and N2 = other.size()
Definition at line 1056 of file slist.inl.
References merge(), and slist().
Referenced by merge(), and lass::stde::value_type< T, Alloc >::sort().
void lass::stde::slist< T, Alloc >::merge | ( | slist< T, Alloc > & | other, |
BinaryPredicate | compare ) |
Merge two by compare sorted containers to one big sorted.
Both *this
and other must be sorted according to compare, and they must be distinct (&other != this
). This function removes all of other'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 other, then the element from *this
will precede the one from other. All iterators to elements in *this
and other remain valid.
other | the other sorted slist |
compare | must define strict weak ordening. Both containers must be sorted by this predicate. |
complexity: O(N1) + O(N2) with N1 = this->size()
and N2 = other.size()
Definition at line 1079 of file slist.inl.
References slist(), and splice_after().
void lass::stde::slist< T, Alloc >::sort | ( | ) |
Sorts *this
according to operator<
.
The sort is stable, that is, the relative order of equivalent elements is preserved. All iterators remain valid and continue to point to the same elements.
complexity: O(N log N) with N = this->size()
Definition at line 1108 of file slist.inl.
References sort().
Referenced by sort().
void lass::stde::slist< T, Alloc >::reverse | ( | ) |
reverses the order of the elements.
All iterators stay valid.
complexity: O(N) with N = this->size()
Definition at line 1171 of file slist.inl.
References begin().
Referenced by lass::stde::value_type< T, Alloc >::operator>>().
void lass::stde::slist< T, Alloc >::assign | ( | ForwardIterator | first, |
ForwardIterator | last ) |
replace *this
by a list copied from a range.
first | iterator to first element of range to be copied in list. |
last | iterator to position after the last element to be copied in list. last must be forward reachable from first. |
complexity: O(N1) + O(N2) with N1 = this->size()
and N2 = std::distance(first, last)
.
void lass::stde::slist< T, Alloc >::sort | ( | BinaryPredicate | compare | ) |
Sorts *this
according to compare.
compare | must define strict weak ordening. Both containers must be sorted by this predicate. |
The sort is stable, that is, the relative order of equivalent elements is preserved. All iterators remain valid and continue to point to the same elements.
complexity: O(N log N) with N = this->size()
|
returns wether a and b are lexicographical idential.
a | first slist |
b | second slist |
returns true if a.size() == b.size()
and each element of is considered equal to its corresponding element in b by using operator==
@complexity O(N) with N = a.size() == b.size() ? a.size() : 1
|
returns wether a is lexicographical less than b.
a | first slist |
b | second slist |
returns true if for the first difference between a and b the element of a is less than the corresponding one of b. In case no different elements between and b can be found, it returns true if a.size() < b.size()
@complexity O(N) with N = std::min(a.size(), b.size())
|
|