![]() |
Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/data/SortedList.h>
Classes | |
| class | Iter |
Public Types | |
| typedef T | t |
| typedef SortedList< T, C, A > | self_t |
Public Member Functions | |
| SortedList (void) | |
| SortedList (const SortedList< T, C, A > &l) | |
| C & | comparator () |
| const C & | comparator () const |
| A & | allocator () |
| void | removeFirst (void) |
| void | removeLast (void) |
| int | count (void) const |
| bool | contains (const T &item) const |
| template<class CC > | |
| bool | containsAll (const CC &c) const |
| bool | isEmpty (void) const |
| operator bool (void) const | |
| Iter | items (void) const |
| Iter | operator* (void) const |
| operator Iter (void) const | |
| Iter | begin (void) const |
| Iter | end (void) const |
| bool | equals (const SortedList< T > &l) const |
| bool | operator== (const SortedList< T > &l) const |
| bool | operator!= (const SortedList< T > &l) const |
| void | clear (void) |
| void | copy (const SortedList< T > &l) |
| void | add (const T &value) |
| template<class CC > | |
| void | addAll (const CC &c) |
| void | remove (const T &item) |
| template<class CC > | |
| void | removeAll (const CC &c) |
| void | remove (const Iter &iter) |
| SortedList< T > & | operator+= (const T &v) |
| SortedList< T > & | operator-= (const T &v) |
| const T & | first (void) const |
| const T & | last (void) const |
| Iter | find (const T &item, const Iter &iter) const |
| Iter | find (const T &item) const |
| T & | at (const Iter &i) |
| Iter | nth (int n) const |
| SortedList< T, C > & | operator= (const SortedList< T, C > &sl) |
| bool | operator& (const T &e) const |
| T & | operator[] (int k) |
| const T & | operator[] (int k) const |
Protected Types | |
| typedef List< T, CompareEquiv< C >, A > | list_t |
Protected Member Functions | |
| void | set (Iter i, const T &val) |
Protected Attributes | |
| list_t | list |
This class provides a sorted list implementation using single-link lists (List). Elements are sorted in increasing order of the used comparator.
Its performances are not very good but the memory footprint is very low. Use it only for small collection of elements.
| T | Type of data stored in the list. |
| A | Adapter to access key part (must implement concept elm::concept::Adapter). |
| C | Comparator of the stored items (must implement the concept elm::concept::Comparator). |
|
protected |
| typedef SortedList<T, C, A> self_t |
| typedef T t |
|
inline |
|
inline |
|
inline |
|
inline |
References List< T, E, A >::addAll(), and SortedList< T, C, A >::list.
|
inline |
References List< T, E, A >::allocator(), and SortedList< T, C, A >::list.
|
inline |
References List< T, E, A >::at(), and SortedList< T, C, A >::list.
References SortedList< T, C, A >::items().
Referenced by SortedList< T, C, A >::equals(), SortedList< T, C, A >::find(), and ListSet< T, C, A >::subsetOf().
References List< T, E, A >::clear(), and SortedList< T, C, A >::list.
|
inline |
References List< T, E, A >::equivalence(), and SortedList< T, C, A >::list.
Referenced by SortedList< T, C, A >::add(), ListSet< T, C, A >::diff(), SortedList< T, C, A >::equals(), SortedList< T, C, A >::find(), ListSet< T, C, A >::join(), ListSet< T, C, A >::meet(), and ListSet< T, C, A >::subsetOf().
|
inline |
References List< T, E, A >::equivalence(), and SortedList< T, C, A >::list.
|
inline |
References SortedList< T, C, A >::end(), and SortedList< T, C, A >::find().
Referenced by ListMap< K, T, C, E, A >::contains(), SortedList< T, C, A >::containsAll(), and ListSet< T, C, A >::insert().
|
inline |
References SortedList< T, C, A >::contains().
|
inline |
References List< T, E, A >::copy(), and SortedList< T, C, A >::list.
|
inline |
Count the items in the list.
References List< T, E, A >::count(), and SortedList< T, C, A >::list.
Referenced by ListMap< K, T, C, E, A >::count().
Referenced by SortedList< T, C, A >::contains(), and SortedList< T, C, A >::find().
|
inline |
|
inline |
References SortedList< T, C, A >::begin(), and SortedList< T, C, A >::find().
Referenced by SortedList< T, C, A >::find().
References SortedList< T, C, A >::comparator(), SortedList< T, C, A >::end(), and elm::iter().
Referenced by SortedList< T, C, A >::contains().
|
inline |
Get the first item of the list.
References List< T, E, A >::first(), and SortedList< T, C, A >::list.
Test if the list is empty.
References List< T, E, A >::isEmpty(), and SortedList< T, C, A >::list.
Referenced by ListMap< K, T, C, E, A >::isEmpty().
|
inline |
Get the last item of the list. Remark that this method is really inefficient. Its working time is in O(n), n number of nodes in the list. Use it only with small list or revert to more powerful data structures.
References List< T, E, A >::last(), and SortedList< T, C, A >::list.
|
inline |
References List< T, E, A >::isEmpty(), and SortedList< T, C, A >::list.
References SortedList< T, C, A >::items().
|
inline |
References SortedList< T, C, A >::equals().
|
inline |
References List< T, E, A >::contains(), and SortedList< T, C, A >::list.
References SortedList< T, C, A >::items().
|
inline |
References SortedList< T, C, A >::add().
|
inline |
References SortedList< T, C, A >::remove().
|
inline |
References List< T, E, A >::copy(), and SortedList< T, C, A >::list.
|
inline |
References SortedList< T, C, A >::equals().
|
inline |
References SortedList< T, C, A >::list.
|
inline |
References SortedList< T, C, A >::list.
References SortedList< T, C, A >::list, and List< T, E, A >::remove().
|
inline |
Remove the given item from the list or just one if the list contains many items equals to the given one. The item type T must support the equality / inequality operators.
| item | Item to remove. |
References SortedList< T, C, A >::list, and List< T, E, A >::remove().
Referenced by SortedList< T, C, A >::operator-=(), ListSet< T, C, A >::operator-=(), and ListMap< K, T, C, E, A >::remove().
|
inline |
References SortedList< T, C, A >::list, and List< T, E, A >::removeAll().
Remove the first item from the list.
References SortedList< T, C, A >::list, and List< T, E, A >::removeFirst().
Remove the last item from the list. Remark that this method is really inefficient. Its working time is in O(n), n number of nodes in the list. Use it only with small list or revert to more powerful data structures.
References SortedList< T, C, A >::list, and List< T, E, A >::removeLast().
References SortedList< T, C, A >::list, and List< T, E, A >::set().
Referenced by ListMap< K, T, C, E, A >::put().
|
protected |
Referenced by SortedList< T, C, A >::add(), SortedList< T, C, A >::addAll(), SortedList< T, C, A >::allocator(), SortedList< T, C, A >::at(), SortedList< T, C, A >::clear(), SortedList< T, C, A >::comparator(), SortedList< T, C, A >::copy(), SortedList< T, C, A >::count(), ListSet< T, C, A >::diff(), SortedList< T, C, A >::first(), SortedList< T, C, A >::isEmpty(), ListSet< T, C, A >::join(), SortedList< T, C, A >::last(), ListSet< T, C, A >::meet(), SortedList< T, C, A >::operator bool(), SortedList< T, C, A >::operator&(), SortedList< T, C, A >::operator=(), SortedList< T, C, A >::operator[](), SortedList< T, C, A >::remove(), SortedList< T, C, A >::removeAll(), SortedList< T, C, A >::removeFirst(), SortedList< T, C, A >::removeLast(), and SortedList< T, C, A >::set().