last update 20 Sep 2009 |
#include <cvrSmallObjectList.h>
Classes | |
class | const_iterator |
Const_iterator class (allows read-only operations). More... | |
class | iterator |
Iterator class (allows read and write operations) The use of the iterator classes is similar to the iterators of the STL (Standard Template Library). More... | |
Public Types | |
typedef unsigned int | size_type |
typedef T & | reference |
typedef const T & | const_reference |
typedef T * | pointer |
typedef const T * | const_pointer |
typedef T | value_type |
Public Member Functions | |
smallObjectList () | |
smallObjectList (const smallObjectList &l) | |
~smallObjectList () | |
size_type | size () const |
bool | empty () const |
void | clear () |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
iterator | erase (iterator pos) |
iterator | erase (iterator first, iterator last) |
iterator | insert (iterator pos, const_iterator first, const_iterator last) |
iterator | insert (iterator pos, size_type n, const T &x) |
iterator | insert (iterator pos, const T &x) |
void | remove (const T &x) |
void | push_front (const T &x) |
void | push_back (const T &x) |
void | pop_front () |
void | pop_back () |
reference | front () |
const_reference | front () const |
reference | back () |
const_reference | back () const |
void | sort () |
template<class Compare > | |
void | sort (Compare comp) |
void | swap (smallObjectList< T > &l) |
void | splice (iterator position, smallObjectList< T > &other) |
void | splice (iterator position, smallObjectList< T > &other, iterator it) |
void | splice (iterator position, smallObjectList< T > &other, iterator begin, iterator end) |
smallObjectList< T > & | operator= (const smallObjectList< T > &l) |
The cvrsmallObjectList is an efficient implementation of a (double) linked list for small data types.
Each instance maintains its own heap, which may be expensive in memory consumption, but they are intended as very fast data structures with respect to memory reservation issues. It should serve, in many cases, as a drop-in replacement for std::list.
typedef const T* cvr::smallObjectList< T >::const_pointer |
Const_pointer type (allows read-only operations) The use of the pointer classes is similar to the references of the STL (Standard Template Library).
typedef const T& cvr::smallObjectList< T >::const_reference |
Const_reference type (allows read-only operations) The use of the reference classes is similar to the references of the STL (Standard Template Library).
typedef T* cvr::smallObjectList< T >::pointer |
Pointer type (allows read and write operations) The use of the pointer classes is similar to the references of the STL (Standard Template Library).
typedef T& cvr::smallObjectList< T >::reference |
Reference type (allows read and write operations) The use of the reference classes is similar to the references of the STL (Standard Template Library).
typedef unsigned int cvr::smallObjectList< T >::size_type |
The type used to store the size of this list.
typedef T cvr::smallObjectList< T >::value_type |
The type of the values stored in the list.
cvr::smallObjectList< T >::smallObjectList | ( | ) |
Default constructor.
Creates an empty smallObjectList.
cvr::smallObjectList< T >::smallObjectList | ( | const smallObjectList< T > & | l | ) |
Copy constructor.
Creates a smallObjectList with the same contents as the given list.
cvr::smallObjectList< T >::~smallObjectList | ( | ) |
Destructor.
const_reference cvr::smallObjectList< T >::back | ( | ) | const |
Returns a const_reference to the last element of the list.
reference cvr::smallObjectList< T >::back | ( | ) |
Returns a reference to the last element of the list.
const_iterator cvr::smallObjectList< T >::begin | ( | ) | const |
Returns a const_iterator pointing to the first element of the list.
The use of the interators is similar to the iterators of the Standard Template Library (STL).
iterator cvr::smallObjectList< T >::begin | ( | ) |
void cvr::smallObjectList< T >::clear | ( | ) |
Empties the list.
bool cvr::smallObjectList< T >::empty | ( | ) | const |
Returns true if the list has no elements, false otherwise.
const_iterator cvr::smallObjectList< T >::end | ( | ) | const |
Returns a const_iterator pointing after the last element of the list.
The use of the interators is similar to the iterators of the Standard Template Library (STL).
iterator cvr::smallObjectList< T >::end | ( | ) |
iterator cvr::smallObjectList< T >::erase | ( | iterator | first, | |
iterator | last | |||
) |
Erases the elements between first and last, and returns an iterator pointing to the next element after last.
iterator cvr::smallObjectList< T >::erase | ( | iterator | pos | ) |
Erases the element at position pos, and returns an iterator pointing to the next element after pos.
const_reference cvr::smallObjectList< T >::front | ( | ) | const |
Returns a const_reference to the first element of the list.
reference cvr::smallObjectList< T >::front | ( | ) |
Returns a reference to the first element of the list.
iterator cvr::smallObjectList< T >::insert | ( | iterator | pos, | |
const T & | x | |||
) |
Inserts x before pos, and returns an iterator pointing after the inserted element.
iterator cvr::smallObjectList< T >::insert | ( | iterator | pos, | |
size_type | n, | |||
const T & | x | |||
) |
Inserts n copies of x before pos, and returns an iterator pointing after the last inserted element.
iterator cvr::smallObjectList< T >::insert | ( | iterator | pos, | |
const_iterator | first, | |||
const_iterator | last | |||
) |
Inserts the range [first, last) before pos, and returns an iterator pointing after the last inserted element.
smallObjectList<T>& cvr::smallObjectList< T >::operator= | ( | const smallObjectList< T > & | l | ) |
void cvr::smallObjectList< T >::pop_back | ( | ) |
Removes the last element from the list.
void cvr::smallObjectList< T >::pop_front | ( | ) |
Removes the first element from the list.
void cvr::smallObjectList< T >::push_back | ( | const T & | x | ) |
Inserts x at the end of the list.
void cvr::smallObjectList< T >::push_front | ( | const T & | x | ) |
Inserts x at the beginning of the list.
void cvr::smallObjectList< T >::remove | ( | const T & | x | ) |
size_type cvr::smallObjectList< T >::size | ( | ) | const |
Returns the number of elements in the list.
void cvr::smallObjectList< T >::sort | ( | Compare | comp | ) | [inline] |
Sorts this list according to the comparison function comp which must return a bool and take two arguments of type T.
void cvr::smallObjectList< T >::sort | ( | ) |
Sorts this list according to the < operator.
void cvr::smallObjectList< T >::splice | ( | iterator | position, | |
smallObjectList< T > & | other, | |||
iterator | begin, | |||
iterator | end | |||
) |
Removes the elements in the interval [begin, end] from list other and inserts them before position in this list.
This is NOT a constant time operation. The computational cost is equivalent to use several insert and erase calls sequentially. The method is just provided for interface compatibility with the std::list.
void cvr::smallObjectList< T >::splice | ( | iterator | position, | |
smallObjectList< T > & | other, | |||
iterator | it | |||
) |
void cvr::smallObjectList< T >::splice | ( | iterator | position, | |
smallObjectList< T > & | other | |||
) |
void cvr::smallObjectList< T >::swap | ( | smallObjectList< T > & | l | ) |