Public Member Functions | Protected Member Functions | Protected Attributes

SortedList< T > Class Template Reference

A SortedList is a list where all objects are stored in ascending order. The objects should be capable of doing <,> and ==. If allowmultiples is true, multiple objects with the same value are allowed in the list. More...

List of all members.

Public Member Functions

 SortedList (bool allowmultiples_)
int size () const
const T & operator[] (int idx) const
int indexOf (const T &) const
SortedList< T > & operator+= (const T &)
SortedList< T > & operator-= (const T &)
template<class U >
SortedList< T > & copy (const U &)
template<class U >
SortedList< T > & operator= (const U &)
template<class U >
SortedList< T > & operator+= (const U &)
template<class U >
SortedList< T > & operator-= (const U &)
template<class U >
void intersect (const U &)
void erase ()
void remove (int idx)
std::vector< T > & vec ()
const std::vector< T > & vec () const
T * arr ()
const T * arr () const

Protected Member Functions

int getPos (const T &) const

Protected Attributes

bool allowmultiples
VectorAccess< T > tvec

Detailed Description

template<class T>
class SortedList< T >

A SortedList is a list where all objects are stored in ascending order. The objects should be capable of doing <,> and ==. If allowmultiples is true, multiple objects with the same value are allowed in the list.

A SortedList can be used together with all other lists that have a [] operator, such as TypeSets.


Constructor & Destructor Documentation

template<class T>
SortedList< T >::SortedList ( bool  allowmultiples_  )  [inline]

Member Function Documentation

template<class T>
T* SortedList< T >::arr (  )  [inline]
template<class T>
const T* SortedList< T >::arr (  )  const [inline]
template<class T >
template<class U >
SortedList< T > & SortedList< T >::copy ( const U &  array  )  [inline]
template<class T >
void SortedList< T >::erase (  )  [inline]
template<class T>
int SortedList< T >::getPos ( const T &  typ  )  const [inline, protected]

If not found, it will return position of the item just above, and size() if val is higher than highest val

template<class T>
int SortedList< T >::indexOf ( const T &  typ  )  const [inline]

Returns -1 if not found

template<class T >
template<class U >
void SortedList< T >::intersect ( const U &  b  )  [inline]

Remove all entries not present in both lists.

template<class T >
template<class U >
SortedList< T > & SortedList< T >::operator+= ( const U &  array  )  [inline]
template<class T>
SortedList< T > & SortedList< T >::operator+= ( const T &  nv  )  [inline]
template<class T >
template<class U >
SortedList< T > & SortedList< T >::operator-= ( const U &  array  )  [inline]
template<class T>
SortedList< T > & SortedList< T >::operator-= ( const T &  nv  )  [inline]
template<class T >
template<class U >
SortedList< T > & SortedList< T >::operator= ( const U &  array  )  [inline]
template<class T>
const T& SortedList< T >::operator[] ( int  idx  )  const [inline]
template<class T >
void SortedList< T >::remove ( int  idx  )  [inline]
template<class T>
int SortedList< T >::size (  )  const [inline]
template<class T>
std::vector<T>& SortedList< T >::vec (  )  [inline]
template<class T>
const std::vector<T>& SortedList< T >::vec (  )  const [inline]

Member Data Documentation

template<class T>
bool SortedList< T >::allowmultiples [protected]
template<class T>
VectorAccess<T> SortedList< T >::tvec [protected]