SourcePro C++ 13.0 |
SourcePro® C++ API Reference Guide |
Product Documentation: SourcePro C++ Documentation Home |
Maintains a collection of some type A implemented as a singly-linked list. More...
#include <rw/stdex/slist.h>
Public Types | |
typedef A::template rebind < Node >::other | allocator_type |
typedef ConstIterator | const_iterator |
typedef const T * | const_pointer |
typedef const T & | const_reference |
typedef allocator_type::difference_type | difference_type |
typedef Iterator | iterator |
typedef T * | pointer |
typedef T & | reference |
typedef allocator_type::size_type | size_type |
typedef T | value_type |
Public Member Functions | |
rw_slist () | |
rw_slist (const rw_slist< T, A > &list) | |
rw_slist (rw_slist< T, A > &&list) | |
template<class InputIterator > | |
rw_slist (InputIterator first, InputIterator last) | |
~rw_slist () | |
template<class InputIterator > | |
void | assign (InputIterator first, InputIterator last) |
iterator | begin () |
const_iterator | begin () const |
More... | |
const_iterator | cbegin () const |
More... | |
const_iterator | cend () const |
More... | |
bool | empty () const |
iterator | end () |
const_iterator | end () const |
More... | |
iterator | erase (iterator iter) |
iterator | erase (iterator first, iterator bound) |
T & | front () |
const T & | front () const |
More... | |
iterator | insert (iterator loc, const T &val) |
iterator | insert (iterator loc, T &&val) |
More... | |
template<class InputIterator > | |
iterator | insert (iterator loc, InputIterator first, InputIterator last) |
void | merge (rw_slist< T, A > &donor) |
rw_slist< T, A > & | operator= (const rw_slist< T, A > &list) |
rw_slist< T, A > & | operator= (rw_slist< T, A > &&list) |
void | pop_front () |
void | push_back (const T &item) |
void | push_back (T &&item) |
More... | |
void | push_front (const T &item) |
void | push_front (T &&item) |
More... | |
void | reverse () |
size_type | size () const |
void | sort () |
void | splice (iterator to, rw_slist< T, A > &donor) |
void | splice (iterator to, rw_slist< T, A > &donor, iterator from) |
void | splice (iterator to, rw_slist< T, A > &donor, iterator from_start, iterator from_bound) |
void | swap (rw_slist< T, A > &other) |
void | unique () |
Related Functions | |
(Note that these are not member functions.) | |
template<class T , class A > | |
bool | operator!= (const rw_slist< T, A > &lhs, const rw_slist< T, A > &rhs) |
template<class T , class A > | |
bool | operator< (const rw_slist< T, A > &lhs, const rw_slist< T, A > &rhs) |
template<class T , class A > | |
bool | operator<= (const rw_slist< T, A > &lhs, const rw_slist< T, A > &rhs) |
template<class T , class A > | |
bool | operator== (const rw_slist< T, A > &lhs, const rw_slist< T, A > &rhs) |
template<class T , class A > | |
bool | operator> (const rw_slist< T, A > &lhs, const rw_slist< T, A > &rhs) |
template<class T , class A > | |
bool | operator>= (const rw_slist< T, A > &lhs, const rw_slist< T, A > &rhs) |
Class rw_slist<T,A> maintains a collection of T
, implemented as a singly-linked list. Since this is a value-based list, objects are copied into and out of the links that make up the list. As with all classes that meet the ANSI sequence specification, rw_slist<T,A> provides for iterators that reference its elements. Operations that alter the contents of rw_slist<T,A> invalidate iterators that reference items at or after the location of change.
typedef A::template rebind<Node>::other rw_slist< T, A >::allocator_type |
A type representing the allocator type for the container.
typedef ConstIterator rw_slist< T, A >::const_iterator |
A type that provides a const
forward iterator over the elements in the container.
typedef const T* rw_slist< T, A >::const_pointer |
A type that provides a const
pointer to an element in the container.
typedef const T& rw_slist< T, A >::const_reference |
A type that provides a const
reference to an element in the container.
typedef allocator_type::difference_type rw_slist< T, A >::difference_type |
A signed integral type used to indicate the distance between two valid iterators on the same container.
A type that provides a forward iterator over the elements in the container.
A type that provides a pointer to an element in the container.
A type that provides a reference to an element in the container.
typedef allocator_type::size_type rw_slist< T, A >::size_type |
An unsigned integral type used for counting the number of elements in the container.
typedef T rw_slist< T, A >::value_type |
A type representing the container's data type.
Constructs an empty rw_slist<T,A> .
rw_slist< T, A >::rw_slist | ( | const rw_slist< T, A > & | list | ) |
Constructs an rw_slist<T,A> that is a copy of list. Each element from list is copied into self.
rw_slist< T, A >::rw_slist | ( | rw_slist< T, A > && | list | ) |
Move constructor. The constructed list takes ownership of the data owned by list.
|
inline |
Constructs an rw_slist<T,A> containing a copy of each element in the range [first, last).
InputIterator
is an input iterator type where the iterator points to elements that are convertible to value_type objects.
The destructor releases the memory used by the links.
void rw_slist< T, A >::assign | ( | InputIterator | first, |
InputIterator | last | ||
) |
Copies each element in the range [first, last) into self, replacing any existing items.
InputIterator
is an input iterator type where the iterator points to elements that are convertible to value_type objects.
Returns an iterator referring to the first element in the container.
If the container is empty, returns end().
|
inline |
Returns an iterator referring to the first element in the container.
If the container is empty, returns end().
|
inline |
Returns an iterator referring to the first element in the container.
If the container is empty, returns end().
|
inline |
Returns an iterator referring to the element after the last element in the container.
Dereferencing the iterator returned by this function results in undefined behavior.
|
inline |
Returns true
if self is empty.
Returns an iterator referring to the element after the last element in the container.
Dereferencing the iterator returned by this function results in undefined behavior.
|
inline |
Returns an iterator referring to the element after the last element in the container.
Dereferencing the iterator returned by this function results in undefined behavior.
Removes from self the element referenced by iter. If iter does not reference an actual item contained in self, the effect is undefined. Returns an iterator referencing the location just after the erased item.
iterator rw_slist< T, A >::erase | ( | iterator | first, |
iterator | bound | ||
) |
Removes from self the elements referenced by the range beginning at first and bounded by bound. Returns an iterator referencing a position just after the last erased item. If first does not reference an item in self (and if first and bound are not equal), the effect is undefined.
|
inline |
References the first item in the list as an L-value. If self is empty, the behavior is undefined.
|
inline |
References the first item in the list as an L-value. If self is empty, the behavior is undefined.
iterator rw_slist< T, A >::insert | ( | iterator | loc, |
const T & | val | ||
) |
Inserts val just prior to the place referenced by loc. Returns an iterator referencing the newly inserted element.
++(list.insert(loc,val)) == loc
iterator rw_slist< T, A >::insert | ( | iterator | loc, |
T && | val | ||
) |
Inserts val just prior to the place referenced by loc. Returns an iterator referencing the newly inserted element.
++(list.insert(loc,val)) == loc
|
inline |
Inserts a copy of each item in the range [first, last) into self just prior to the place referenced by loc. Returns an iterator referencing the first newly inserted element.
InputIterator
is an input iterator type where the iterator points to elements that are convertible to value_type objects.
void rw_slist< T, A >::merge | ( | rw_slist< T, A > & | donor | ) |
Assuming both donor and self are sorted, moves every item from donor into self, leaving donor empty, and self sorted. If either list is unsorted, the move will take place, but the result may not be sorted. This method does not copy or destroy the items in donor, but re-links list nodes into self.
rw_slist<T, A>& rw_slist< T, A >::operator= | ( | const rw_slist< T, A > & | list | ) |
Copy assignment. Constructs an rw_slist<T,A> containing a copy of each element in list.
rw_slist<T, A>& rw_slist< T, A >::operator= | ( | rw_slist< T, A > && | list | ) |
Move assignment. Self takes ownership of the data owned by list.
|
inline |
Erases the first element of self. If self is empty, the effect is undefined.
|
inline |
Inserts item as the last element of the list.
|
inline |
Inserts item as the last element of the list.
|
inline |
Inserts item as the first element of the list.
|
inline |
Inserts item as the first element of the list.
void rw_slist< T, A >::reverse | ( | ) |
Reverses the order of the nodes containing the elements in self.
Returns the number of items currently held in self.
void rw_slist< T, A >::sort | ( | ) |
Sorts self according to T::operator<(T)
or equivalent. Runs in time proportional to N
log(N)
, where N
is the number of elements. This method does not copy or destroy any of the items exchanged during the sort, but adjusts the order of the links in the list.
|
inline |
Inserts the entire contents of donor into self, just before the position referenced by to, leaving donor empty. This method does not copy or destroy any of the items moved, but re-links the list nodes from donor into self.
void rw_slist< T, A >::splice | ( | iterator | to, |
rw_slist< T, A > & | donor, | ||
iterator | from | ||
) |
Removes from donor and inserts into self, just before location to, the item referenced by from. If from does not reference an actual item contained in donor the effect is undefined. This method does not copy or destroy the item referenced by from, but re-links the node containing it from donor into self.
void rw_slist< T, A >::splice | ( | iterator | to, |
rw_slist< T, A > & | donor, | ||
iterator | from_start, | ||
iterator | from_bound | ||
) |
Removes from donor and inserts into self just before location to, the items referenced by the range beginning with from_start and bounded by from_bound. If that range does not refer to items contained by donor, the effect is undefined. This method does not copy or destroy the items referenced by the range, but re-links those list nodes from donor into self.
void rw_slist< T, A >::swap | ( | rw_slist< T, A > & | other | ) |
Exchanges the contents of self with other, retaining the ordering of each. This method does not copy or destroy any of the items exchanged, but re-links the lists.
void rw_slist< T, A >::unique | ( | ) |
Removes from self all but the first element from each equal range. A precondition is that any duplicate elements are adjacent.
|
related |
Equivalent to !(lhs == rhs)
.
|
related |
Returns the result of calling:
|
related |
Equivalent to !(rhs < lhs)
.
|
related |
Returns true if lhs and rhs have the same number of elements and each element of rhs tests equal (T::operator==()
or equivalent) to the corresponding element of lhs.
|
related |
Equivalent to (rhs < lhs)
.
Copyright © 2014 Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.