List

## template class List

> lists of objects of arbitrary type T.

## Inheritance:

### Public Methods

  | List () create an empty list.
  virtual | ~List () delete entire list (but not the elements of the list).
  | List (const List &l) create list, initialized by elements of l.
  List & | operator= (const List &l) copy list into an other, elements are copied too (e.g. l2 = l1).
  void | add (const T &e) add e to the end of the list.
  void | insert (const T &e, const unsigned i) insert e to i+1'th position of the list.
  int | find (const T &e) const return index of first element equal to e, if not found, return -1.
  bool | isSet () const return list is set
  int | count (const T &e) const count the number of times e occurs in the list
  bool | contains (List *l) const return if list contains list l
  bool | contains (const T &e) const return if list contains e.
  void | remove (const T &e) remove all elements equal to e.
  void | removei (const unsigned i = 0) removes i+1'th element (0 <= i <= count()-1).
  bool | removecur () removes current element and advances the current to the next one.
  void | empty () removes all elements from list.
  virtual void | clear () removes all elements + free elements (which should be pointers).
  T& | operator[] (const unsigned i) const returns ref. to i+1'th element, like array index (e.g. e = l[5]).
  T& | elem (const unsigned i) const same as [] (different syntax).
  unsigned | count () const returns number of elements in list.
  void | replace (const T &old, const T &fresh) replaces all elements equal to old by new.
  void | sort (int (*cmp)(T, T)) sort all elements according to cmp function.
  void | reverse () reverse all elements in list.
  int | first () return if there is a first element + sets current to first element.
  int | last () sets current to last element + returns if there is a last element.
  int | next () sets current to next element + returns if there is a next element.
  int | prev () sets current to prev. element + returns if there is a prev. element.
  T& | cur () const returns current element (Check first with 'done'!)
  bool | done () const returns if current is out of list.
  int | setcur (const T &) returns if T is in list + sets current to that element.

## Documentation

> lists of objects of arbitrary type T.

`List()`
  create an empty list.

`virtual ~List()`
  delete entire list (but not the elements of the list).

`List(const List &l)`
  create list, initialized by elements of l.

`List & operator=(const List &l)`
  copy list into an other, elements are copied too (e.g. l2 = l1).

`void add(const T &e)`
  add e to the end of the list.

`void insert(const T &e, const unsigned i)`
  insert e to i+1'th position of the list.

`int find(const T &e) const`
  return index of first element equal to e, if not found, return -1.

`bool isSet() const`
  return list is set

`int count(const T &e) const`
  count the number of times e occurs in the list

`bool contains(List *l) const`
  return if list contains list l

`bool contains(const T &e) const`
  return if list contains e.

`void remove(const T &e)`
  remove all elements equal to e.

`void removei(const unsigned i = 0)`
  removes i+1'th element (0 <= i <= count()-1).

`bool removecur()`
  removes current element and advances the current to the next one.

`void empty()`
  removes all elements from list.

`virtual void clear()`
  removes all elements + free elements (which should be pointers).

`T& operator[] (const unsigned i) const`
  returns ref. to i+1'th element, like array index (e.g. e = l[5]).

`T& elem(const unsigned i) const`
  same as [] (different syntax).

`unsigned count() const`
  returns number of elements in list.

`void replace(const T &old, const T &fresh)`
  replaces all elements equal to old by new.

`void sort(int (*cmp)(T, T))`
  sort all elements according to cmp function.

`void reverse()`
  reverse all elements in list.

`int first()`
  return if there is a first element + sets current to first element.

`int last()`
  sets current to last element + returns if there is a last element.

`int next()`
  sets current to next element + returns if there is a next element.

`int prev()`
  sets current to prev. element + returns if there is a prev. element.

`T& cur() const`
  returns current element (Check first with 'done'!)

`bool done() const`
  returns if current is out of list.

`int setcur(const T &)`
  returns if T is in list + sets current to that element.

Direct child classes:
  Subjects
  Shapes
  Properties
  AssocList

alphabetic index hierarchy of classes

this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de