C++ Portable Types Library (PTypes) Version 1.7


Top: Basic types: Lists

PTypes provides three different types of dynamic arrays: list of objects (objlist), list of string/object pairs, optionally sorted (strlist), and associative array of objects mapped through strings (strmap). Unlike STL, PTypes uses no templates: lists always work with objects of type unknown or any derivative class. A list (naturally) can contain objects of different types simultaneously.

PTypes lists can optionally free member objects whenever an item is deleted or the entire list is destroyed. This mechanism called "owning objects" can be turned on or off during construction of a list object.

Lists themselves are derived from unknown, thus allowing to construct more complex dynamic structures, such like multidimensional arrays or trees.

Like with string and cset classes, most of the list manipulator functions are defined outside of the classes definitions, i.e. as friend functions. For example, you write add(list, item) instead of list.add(item). This style imitates built-in language types and produces lesser member function calls in your program. In our opinion this style helps to improve readability of your code.

The list class family is declared in <ptypes.h>.

See also: unknown


PTypes home