blocxx
|
This class is a wrapper around std::list<> and adds COW capabilities. More...
#include <List.hpp>
Public Types | |
typedef L::value_type | value_type |
typedef L::pointer | pointer |
typedef L::const_pointer | const_pointer |
typedef L::reference | reference |
typedef L::const_reference | const_reference |
typedef L::size_type | size_type |
typedef L::difference_type | difference_type |
typedef L::iterator | iterator |
typedef L::const_iterator | const_iterator |
typedef L::reverse_iterator | reverse_iterator |
typedef L::const_reverse_iterator | const_reverse_iterator |
Public Member Functions | |
List () | |
Default Constructor. | |
List (L *toWrap) | |
Constructor. | |
template<class InputIterator > | |
List (InputIterator first, InputIterator last) | |
Construct a List from a range specified with InputIterators. | |
List (size_type n, const T &value) | |
Construct a List that consist of a specified number of elements that are copies of a given object. | |
List (int n, const T &value) | |
Construct a List that consist of a specified number of elements that are copies of a given object. | |
List (long n, const T &value) | |
Construct a List that consist of a specified number of elements that are copies of a given object. | |
List (size_type n) | |
Construct a List that consist of a specified number of elements that have be constructed using the default constructor of class T. | |
L * | getImpl () |
| |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
reverse_iterator | rbegin () |
const_reverse_iterator | rbegin () const |
reverse_iterator | rend () |
const_reverse_iterator | rend () const |
bool | empty () const |
size_type | size () const |
size_type | max_size () const |
reference | front () |
const_reference | front () const |
reference | back () |
const_reference | back () const |
void | swap (List< T > &x) |
Exchanges the elements of the current list with those of another. | |
iterator | insert (iterator position, const T &x) |
Insert an element to the List before the element specified by the iterator. | |
iterator | insert (iterator position) |
Insert an default-constructed element to the List before the element specified by the iterator. | |
template<class InputIterator > | |
void | insert (iterator position, InputIterator first, InputIterator last) |
Insert a range of elements before a given position in the List. | |
void | insert (iterator pos, size_type n, const T &x) |
Insert a specified number of elements that are copies of a given object before the given position in the List. | |
void | insert (iterator pos, int n, const T &x) |
Insert a specified number of elements that are copies of a given object before the given position in the List. | |
void | insert (iterator pos, long n, const T &x) |
Insert a specified number of elements that are copies of a given object before the given position in the List. | |
void | push_front (const T &x) |
Prepend the specified element at the front of the List. | |
void | push_back (const T &x) |
Append the specified element to the end of the List. | |
iterator | erase (iterator position) |
Remove an element from the List specified with an iterator. | |
iterator | erase (iterator first, iterator last) |
Remove elements from the List specified by a beginning and ending iterator. | |
void | resize (size_type new_size, const T &x) |
Ensure the List has a given size. | |
void | resize (size_type new_size) |
Ensure the List has a given size appending a default-constructed object to the end of the List if it is enlarged. | |
void | clear () |
Remove all items from the List. | |
const_iterator | find (const T &x, const_iterator first, const_iterator last) const |
Find element x in the list range specified by the first and last iterators. | |
const_iterator | find (const T &x) const |
Find element x in the list. | |
iterator | find (const T &x, iterator first, iterator last) |
Find element x in the list range specified by the first and last iterators. | |
iterator | find (const T &x) |
Find element x in the list. | |
bool | contains (const T &x, const_iterator first, const_iterator last) const |
Determine if element x is contained in the list range specified by the first and last iterators. | |
bool | contains (const T &x) const |
Determine if element x is contained in the list. | |
void | pop_front () |
Remove the first element in the List. | |
void | pop_back () |
Remove the last element in the List. | |
void | splice (iterator position, List &x) |
Move the specified list into the current list at the given position. | |
void | splice (iterator position, List &x, iterator i) |
Move the specified element from list x pointed to by iterator i into the current list at the given position. | |
void | splice (iterator position, List &x, iterator first, iterator last) |
Move the elements from list x specified by first and last iterators into the current list at the given position. | |
void | remove (const T &value) |
Remove the specified element from the List. | |
void | unique () |
Remove all duplicate elements from the List. | |
void | merge (List &x) |
Merge the current and specified lists, producing a combined list that is ordered with respect to the < operator. | |
void | reverse () |
Reverse the order of elements in the list. | |
void | sort () |
Sort the list using the < operator to compare elements. | |
template<class Predicate > | |
void | remove_if (Predicate p) |
Removes all elements from the list for which the unary predicate p is true. | |
template<class BinaryPredicate > | |
void | unique (BinaryPredicate bp) |
Remove all elements from the List for which the binary predicate bp is true. | |
template<class StrictWeakOrdering > | |
void | merge (List &x, StrictWeakOrdering swo) |
Merge the current and specified list, producing a combined list that is ordered with respect to the specified comparisation class. | |
template<class StrictWeakOrdering > | |
void | sort (StrictWeakOrdering swo) |
Sort the list using the specified comparisation class. | |
Private Types | |
typedef std::list< T > | L |
Private Attributes | |
COWReference< L > | m_impl |
Friends | |
bool | operator== (const List< T > &x, const List< T > &y) |
Determine equality of two Lists comparing the size of both lists and all elements in the same position using the elements "==" operator. | |
bool | operator< (const List< T > &x, const List< T > &y) |
Determine if one Lists is less than another comparing the size of both lists and all their elements. |
This class is a wrapper around std::list<> and adds COW capabilities.
typedef L::const_iterator BLOCXX_NAMESPACE::List< T >::const_iterator |
typedef L::const_pointer BLOCXX_NAMESPACE::List< T >::const_pointer |
typedef L::const_reference BLOCXX_NAMESPACE::List< T >::const_reference |
typedef L::const_reverse_iterator BLOCXX_NAMESPACE::List< T >::const_reverse_iterator |
typedef L::difference_type BLOCXX_NAMESPACE::List< T >::difference_type |
typedef L::iterator BLOCXX_NAMESPACE::List< T >::iterator |
typedef std::list<T> BLOCXX_NAMESPACE::List< T >::L [private] |
typedef L::pointer BLOCXX_NAMESPACE::List< T >::pointer |
typedef L::reference BLOCXX_NAMESPACE::List< T >::reference |
typedef L::reverse_iterator BLOCXX_NAMESPACE::List< T >::reverse_iterator |
typedef L::size_type BLOCXX_NAMESPACE::List< T >::size_type |
typedef L::value_type BLOCXX_NAMESPACE::List< T >::value_type |
BLOCXX_NAMESPACE::List< T >::List | ( | ) | [inline] |
BLOCXX_NAMESPACE::List< T >::List | ( | L * | toWrap | ) | [inline, explicit] |
BLOCXX_NAMESPACE::List< T >::List | ( | InputIterator | first, |
InputIterator | last | ||
) | [inline] |
BLOCXX_NAMESPACE::List< T >::List | ( | size_type | n, |
const T & | value | ||
) | [inline] |
BLOCXX_NAMESPACE::List< T >::List | ( | int | n, |
const T & | value | ||
) | [inline] |
BLOCXX_NAMESPACE::List< T >::List | ( | long | n, |
const T & | value | ||
) | [inline] |
BLOCXX_NAMESPACE::List< T >::List | ( | size_type | n | ) | [inline, explicit] |
reference BLOCXX_NAMESPACE::List< T >::back | ( | ) | [inline] |
Definition at line 255 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
const_reference BLOCXX_NAMESPACE::List< T >::back | ( | ) | const [inline] |
Definition at line 262 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
iterator BLOCXX_NAMESPACE::List< T >::begin | ( | ) | [inline] |
Definition at line 150 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
Referenced by BLOCXX_NAMESPACE::List< T >::contains(), and BLOCXX_NAMESPACE::List< T >::find().
const_iterator BLOCXX_NAMESPACE::List< T >::begin | ( | ) | const [inline] |
Definition at line 159 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::clear | ( | ) | [inline] |
bool BLOCXX_NAMESPACE::List< T >::contains | ( | const T & | x, |
const_iterator | first, | ||
const_iterator | last | ||
) | const [inline] |
Determine if element x is contained in the list range specified by the first and last iterators.
x | The element to seach for. |
first | The first position iterator; begin of the range. |
last | The last position iterator; end of the range. |
Definition at line 488 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::end(), and BLOCXX_NAMESPACE::List< T >::find().
bool BLOCXX_NAMESPACE::List< T >::contains | ( | const T & | x | ) | const [inline] |
Determine if element x is contained in the list.
x | The element to seach for. |
Definition at line 498 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::begin(), BLOCXX_NAMESPACE::List< T >::end(), and BLOCXX_NAMESPACE::List< T >::find().
bool BLOCXX_NAMESPACE::List< T >::empty | ( | ) | const [inline] |
Definition at line 220 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
iterator BLOCXX_NAMESPACE::List< T >::end | ( | ) | [inline] |
Definition at line 168 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
Referenced by BLOCXX_NAMESPACE::List< T >::contains(), and BLOCXX_NAMESPACE::List< T >::find().
const_iterator BLOCXX_NAMESPACE::List< T >::end | ( | ) | const [inline] |
Definition at line 177 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
iterator BLOCXX_NAMESPACE::List< T >::erase | ( | iterator | position | ) | [inline] |
Remove an element from the List specified with an iterator.
position | An iterator that points to the element to be removed. |
Definition at line 373 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
iterator BLOCXX_NAMESPACE::List< T >::erase | ( | iterator | first, |
iterator | last | ||
) | [inline] |
Remove elements from the List specified by a beginning and ending iterator.
first | An iterator that specifies the first element to remove. |
last | An iterator that specifies the last element to remove. |
Definition at line 386 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
iterator BLOCXX_NAMESPACE::List< T >::find | ( | const T & | x, |
iterator | first, | ||
iterator | last | ||
) | [inline] |
Find element x in the list range specified by the first and last iterators.
x | The element to seach for. |
first | The first position iterator; begin of the range. |
last | The last position iterator; end of the range. |
Definition at line 458 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::end().
const_iterator BLOCXX_NAMESPACE::List< T >::find | ( | const T & | x | ) | const [inline] |
Find element x in the list.
x | The element to seach for. |
Definition at line 445 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::begin(), BLOCXX_NAMESPACE::List< T >::end(), and BLOCXX_NAMESPACE::List< T >::find().
iterator BLOCXX_NAMESPACE::List< T >::find | ( | const T & | x | ) | [inline] |
Find element x in the list.
x | The element to seach for. |
Definition at line 475 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::begin(), BLOCXX_NAMESPACE::List< T >::end(), and BLOCXX_NAMESPACE::List< T >::find().
const_iterator BLOCXX_NAMESPACE::List< T >::find | ( | const T & | x, |
const_iterator | first, | ||
const_iterator | last | ||
) | const [inline] |
Find element x in the list range specified by the first and last iterators.
x | The element to seach for. |
first | The first position iterator; begin of the range. |
last | The last position iterator; end of the range. |
Definition at line 427 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::end().
Referenced by BLOCXX_NAMESPACE::List< T >::contains(), and BLOCXX_NAMESPACE::List< T >::find().
reference BLOCXX_NAMESPACE::List< T >::front | ( | ) | [inline] |
Definition at line 241 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
const_reference BLOCXX_NAMESPACE::List< T >::front | ( | ) | const [inline] |
Definition at line 248 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
L* BLOCXX_NAMESPACE::List< T >::getImpl | ( | ) | [inline] |
Definition at line 141 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
iterator BLOCXX_NAMESPACE::List< T >::insert | ( | iterator | position, |
const T & | x | ||
) | [inline] |
Insert an element to the List before the element specified by the iterator.
position | An iterator that points to the insertion point. The element will be inserted before this point. |
x | The element to insert into the List. |
Definition at line 282 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
iterator BLOCXX_NAMESPACE::List< T >::insert | ( | iterator | position | ) | [inline] |
Insert an default-constructed element to the List before the element specified by the iterator.
position | An iterator that points to the insertion point. The element will be inserted before this point. |
Definition at line 293 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::insert | ( | iterator | position, |
InputIterator | first, | ||
InputIterator | last | ||
) | [inline] |
Insert a range of elements before a given position in the List.
position | The position to insert the elements at. The insertion will be done before this position. |
first | The beginning of the range of elements to insert. |
last | The end of the range of elements to insert. |
Definition at line 305 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::insert | ( | iterator | pos, |
size_type | n, | ||
const T & | x | ||
) | [inline] |
Insert a specified number of elements that are copies of a given object before the given position in the List.
pos | The position to insert the elements before. |
n | Number of elements to insert. |
x | The value every newly inserted element of the List will be initialized to. |
Definition at line 318 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::insert | ( | iterator | pos, |
int | n, | ||
const T & | x | ||
) | [inline] |
Insert a specified number of elements that are copies of a given object before the given position in the List.
pos | The position to insert the elements before. |
n | Number of elements to insert. |
x | The value every newly inserted element of the List will be initialized to. |
Definition at line 331 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::insert | ( | iterator | pos, |
long | n, | ||
const T & | x | ||
) | [inline] |
Insert a specified number of elements that are copies of a given object before the given position in the List.
pos | The position to insert the elements before. |
n | Number of elements to insert. |
x | The value every newly inserted element of the List will be initialized to. |
Definition at line 344 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
size_type BLOCXX_NAMESPACE::List< T >::max_size | ( | ) | const [inline] |
Definition at line 234 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::merge | ( | List< T > & | x | ) | [inline] |
Merge the current and specified lists, producing a combined list that is ordered with respect to the < operator.
x | The list to merge with. |
Definition at line 571 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::merge | ( | List< T > & | x, |
StrictWeakOrdering | swo | ||
) | [inline] |
Merge the current and specified list, producing a combined list that is ordered with respect to the specified comparisation class.
swo | The comparisation functor class. |
Definition at line 612 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::pop_back | ( | ) | [inline] |
Remove the last element in the List.
Definition at line 512 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::pop_front | ( | ) | [inline] |
Remove the first element in the List.
Definition at line 505 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::push_back | ( | const T & | x | ) | [inline] |
Append the specified element to the end of the List.
x | The element to append to the end of the List. |
Definition at line 362 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::push_front | ( | const T & | x | ) | [inline] |
Prepend the specified element at the front of the List.
x | The element to prepend to the front of the List. |
Definition at line 353 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
const_reverse_iterator BLOCXX_NAMESPACE::List< T >::rbegin | ( | ) | const [inline] |
Definition at line 195 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
reverse_iterator BLOCXX_NAMESPACE::List< T >::rbegin | ( | ) | [inline] |
Definition at line 186 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::remove | ( | const T & | value | ) | [inline] |
Remove the specified element from the List.
value | The element to remove. |
Definition at line 555 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::remove_if | ( | Predicate | p | ) | [inline] |
Removes all elements from the list for which the unary predicate p is true.
p | The unary predicate |
Definition at line 594 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
reverse_iterator BLOCXX_NAMESPACE::List< T >::rend | ( | ) | [inline] |
Definition at line 204 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
const_reverse_iterator BLOCXX_NAMESPACE::List< T >::rend | ( | ) | const [inline] |
Definition at line 213 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::resize | ( | size_type | new_size | ) | [inline] |
void BLOCXX_NAMESPACE::List< T >::resize | ( | size_type | new_size, |
const T & | x | ||
) | [inline] |
void BLOCXX_NAMESPACE::List< T >::reverse | ( | ) | [inline] |
Reverse the order of elements in the list.
Definition at line 578 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
size_type BLOCXX_NAMESPACE::List< T >::size | ( | ) | const [inline] |
Definition at line 227 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::sort | ( | ) | [inline] |
Sort the list using the < operator to compare elements.
Definition at line 585 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::sort | ( | StrictWeakOrdering | swo | ) | [inline] |
Sort the list using the specified comparisation class.
swo | The comparisation functor class. |
Definition at line 620 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::splice | ( | iterator | position, |
List< T > & | x, | ||
iterator | i | ||
) | [inline] |
Move the specified element from list x pointed to by iterator i into the current list at the given position.
position | The iterator pointing to the insert position. |
x | The List to insert element from. |
i | The element in List x to move. |
Definition at line 534 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::splice | ( | iterator | position, |
List< T > & | x | ||
) | [inline] |
Move the specified list into the current list at the given position.
position | The iterator pointing to the insert position. |
x | The list to move elements from. |
Definition at line 522 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::splice | ( | iterator | position, |
List< T > & | x, | ||
iterator | first, | ||
iterator | last | ||
) | [inline] |
Move the elements from list x specified by first and last iterators into the current list at the given position.
position | The iterator pointing to the insert position. |
x | The list to insert element from. |
first | The first element in List x to move. |
last | The last element in List x to move. |
Definition at line 547 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::swap | ( | List< T > & | x | ) | [inline] |
Exchanges the elements of the current list with those of another.
Definition at line 270 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl, and BLOCXX_NAMESPACE::COWReference< T >::swap().
Referenced by BLOCXX_NAMESPACE::swap().
void BLOCXX_NAMESPACE::List< T >::unique | ( | ) | [inline] |
Remove all duplicate elements from the List.
Definition at line 562 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
void BLOCXX_NAMESPACE::List< T >::unique | ( | BinaryPredicate | bp | ) | [inline] |
Remove all elements from the List for which the binary predicate bp is true.
bp | The binary predicate |
Definition at line 603 of file List.hpp.
References BLOCXX_NAMESPACE::List< T >::m_impl.
COWReference<L> BLOCXX_NAMESPACE::List< T >::m_impl [private] |
Definition at line 64 of file List.hpp.
Referenced by BLOCXX_NAMESPACE::List< T >::back(), BLOCXX_NAMESPACE::List< T >::begin(), BLOCXX_NAMESPACE::List< T >::clear(), BLOCXX_NAMESPACE::List< T >::empty(), BLOCXX_NAMESPACE::List< T >::end(), BLOCXX_NAMESPACE::List< T >::erase(), BLOCXX_NAMESPACE::List< T >::front(), BLOCXX_NAMESPACE::List< T >::getImpl(), BLOCXX_NAMESPACE::List< T >::insert(), BLOCXX_NAMESPACE::List< T >::max_size(), BLOCXX_NAMESPACE::List< T >::merge(), BLOCXX_NAMESPACE::operator<(), BLOCXX_NAMESPACE::operator==(), BLOCXX_NAMESPACE::List< T >::pop_back(), BLOCXX_NAMESPACE::List< T >::pop_front(), BLOCXX_NAMESPACE::List< T >::push_back(), BLOCXX_NAMESPACE::List< T >::push_front(), BLOCXX_NAMESPACE::List< T >::rbegin(), BLOCXX_NAMESPACE::List< T >::remove(), BLOCXX_NAMESPACE::List< T >::remove_if(), BLOCXX_NAMESPACE::List< T >::rend(), BLOCXX_NAMESPACE::List< T >::resize(), BLOCXX_NAMESPACE::List< T >::reverse(), BLOCXX_NAMESPACE::List< T >::size(), BLOCXX_NAMESPACE::List< T >::sort(), BLOCXX_NAMESPACE::List< T >::splice(), BLOCXX_NAMESPACE::List< T >::swap(), and BLOCXX_NAMESPACE::List< T >::unique().