Top: Basic types: Lists: strmap
The strmap class is a dynamic array of objects derived from unknown, where each object is associated with a string. Unlike strlist, strmap does not provide indexed access to the stored items, it can only retrieve an object by a string value. The searching algorithm is hidden and can be changed in the future releases of PTypes.
Strmap itself is indirectly derived from unknown.
Like in strlist, when an item is removed from the list, or the entire list is cleared (using clear() function) or destroyed, the objects associated with strings are not freed from memory unless the string map was created with SL_OWNOBJECTS flag. "Owning objects" means the string map is responsible for destroying and freeing its member objects.
A class template named tstrmap, fully compatible with strmap, is provided for better type checking at compile time. If you declare a variable, for example, of type tstrmap<myclass>, all manipulation functions for this variable will accept and return pointers to myclass, instead of unknown.
This class is declared in <ptypes.h> header file.
See also: Constructors/destructors, Manipulation, Search