< index
< 8. All purposes container
< 8.5 Iterators

=====================================
8.6 Deleting a list
=====================================

You can delete a list, freeing any allocated resources. Note that deleting the list does not delete it's elements. You have to use clearAndDelete before deleting the list if you want to destroy the elements too.

C++ : virtual template <class T> TCODList::~TCODList()
C   : void TCOD_list_delete(TCOD_list_t l)

ParameterDescription
lIn the C version, the list handler, returned by a constructor.

Example :

C++ : TCODList<int> *intList = new TCODList<int>(); // allocate a new empty list
      intList->push(5); // the list contains 1 element at position 0, value = 5
      delete intList; // destroy the list
C   : TCOD_list_t intList = TCOD_list_new();
      TCOD_list_push(intList,(const void *)5);
      TCOD_list_delete(intList);

insert a comment