GCpp general purpose C++ library  version 1.0
GCpp template classes
General behaviour for collection template classes

The template classes for collections inherits from the abstract base class GCollectionT.

Adding elements to the collections

The derived classes define the functions to add or remove objects in the collection. The default behaviour when adding an object to a collection is the following:

  • if the object is added from ist pointer, it is adopted by the collection, and the objected is deleted if removed from the collection;
  • if the object is added by reference, it is considered as external and it is not adopted by the collection: the user must ensure that the object lives as long as it is used in the collection.

This behaviour can be changed with the collection options flags (see gcoll namespace). For example, setting the option gcollection:gDeepCopy will force the collection, when adding an object, to make a copy of the object (with the Clone() function) and to adopt this copy.

The information whether an objet must be deleted or not is stored in the iterator flags.

The lists templates
The vectors templates
  • class GVectT (note that this class is not called GVectorT, which is used for mathematical vectors)
The trees templates