Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
ListSet< T, C, A > Class Template Reference

#include <elm/data/ListSet.h>

+ Inheritance diagram for ListSet< T, C, A >:

Public Types

typedef T t
 
typedef ListSet< T, C, A > self_t
 
- Public Types inherited from SortedList< T, Comparator< T >, DefaultAlloc >
typedef T t
 
typedef SortedList< T, Comparator< T >, DefaultAllocself_t
 

Public Member Functions

 ListSet (void)
 
 ListSet (const ListSet< T, C > &set)
 
void insert (const T &v)
 
bool subsetOf (const SortedList< T > &l) const
 
bool operator<= (const SortedList< T > &l) const
 
bool operator< (const SortedList< T > &l) const
 
bool operator>= (const SortedList< T > &l) const
 
bool operator> (const SortedList< T > &l) const
 
void join (const self_t &set)
 
void meet (const self_t &set)
 
void diff (const self_t &set)
 
self_toperator+= (const self_t &set)
 
self_toperator|= (const self_t &set)
 
self_toperator*= (const self_t &set)
 
self_toperator&= (const self_t &set)
 
self_toperator-= (const self_t &set)
 
self_toperator+ (const self_t &set)
 
self_toperator| (const self_t &set)
 
self_toperator* (const self_t &set)
 
self_toperator& (const self_t &set)
 
self_toperator- (const self_t &set)
 
void add (const T &v)
 
self_toperator+= (const T &val)
 
self_toperator-= (const T &val)
 
- Public Member Functions inherited from SortedList< T, Comparator< T >, DefaultAlloc >
 SortedList (void)
 
 SortedList (const SortedList< T, Comparator< T >, DefaultAlloc > &l)
 
Comparator< T > & comparator ()
 
const Comparator< T > & comparator () const
 
DefaultAllocallocator ()
 
void removeFirst (void)
 
void removeLast (void)
 
int count (void) const
 
bool contains (const T &item) const
 
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)
 
void addAll (const CC &c)
 
void remove (const T &item)
 
void remove (const Iter &iter)
 
void removeAll (const CC &c)
 
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, Comparator< T > > & operator= (const SortedList< T, Comparator< T > > &sl)
 
bool operator& (const T &e) const
 
T & operator[] (int k)
 
const T & operator[] (int k) const
 

Additional Inherited Members

- Protected Types inherited from SortedList< T, Comparator< T >, DefaultAlloc >
typedef List< T, CompareEquiv< Comparator< T > >, DefaultAlloclist_t
 
- Protected Member Functions inherited from SortedList< T, Comparator< T >, DefaultAlloc >
void set (Iter i, const T &val)
 
- Protected Attributes inherited from SortedList< T, Comparator< T >, DefaultAlloc >
list_t list
 

Detailed Description

template<class T, class C = Comparator<T>, class A = DefaultAlloc>
class elm::ListSet< T, C, A >

Set implemented as a sorted list.

The performances for a set of N elements are:

  • access time: O(N/2) on average, O(N) worst case
  • addition time: O(N/2) on average, O(N) worst case
  • removal time: O(N/2) on average, O(N) worst case
  • set operation time: O(N + M)

For set operation, M is the size of the second operand set.

Parameters
TType of values in the set.
MManager for allocation and comparison operations.

Member Typedef Documentation

◆ self_t

typedef ListSet<T, C, A> self_t

◆ t

typedef T t

Constructor & Destructor Documentation

◆ ListSet() [1/2]

ListSet ( void  )
inline

Default constructor.

◆ ListSet() [2/2]

ListSet ( const ListSet< T, C > &  set)
inline

Member Function Documentation

◆ add()

void add ( const T &  v)
inline

◆ diff()

void diff ( const self_t set)
inline

Remove the current set the values of the given set.

Parameters
setSet of values to return.

References SortedList< T, C, A >::comparator(), SortedList< T, C, A >::list, List< T, E, A >::remove(), and SortedList< T, Comparator< T >, DefaultAlloc >::set().

Referenced by ListSet< T, C, A >::operator-(), and ListSet< T, C, A >::operator-=().

◆ insert()

void insert ( const T &  v)
inline

Insert a value in the set. This adds the value only if it is not already in the set.

Parameters
vAdded value.

References SortedList< T, C, A >::add(), and SortedList< T, C, A >::contains().

Referenced by ListSet< T, C, A >::add(), and ListSet< T, C, A >::operator+=().

◆ join()

◆ meet()

◆ operator&()

◆ operator&=()

◆ operator*()

◆ operator*=()

◆ operator+()

◆ operator+=() [1/2]

◆ operator+=() [2/2]

self_t& operator+= ( const T &  val)
inline

◆ operator-()

◆ operator-=() [1/2]

◆ operator-=() [2/2]

self_t& operator-= ( const T &  val)
inline

◆ operator<()

◆ operator<=()

bool operator<= ( const SortedList< T > &  l) const
inline

◆ operator>()

bool operator> ( const SortedList< T > &  l) const
inline

◆ operator>=()

bool operator>= ( const SortedList< T > &  l) const
inline

◆ operator|()

◆ operator|=()

◆ subsetOf()


The documentation for this class was generated from the following files: