Click on the banner to return to the user guide home page.

©Copyright 1996 Rogue Wave Software

Chapter 12: Generic Collection Classes

Generic collection classes are the second major category of collection classes included in Tools.h++. We call them generic because they use the macros defined in <generic.h>, an early approximation to parameterized types first described in Stroustrup (1986, p. 209). Generic collection classes are less manageable than true templates[17], but they are portable to any C++ compiler. You can use them even with older compilers.

Most of the generic collection classes use reference-based semantics; that is, they store and retrieve pointers to other objects, as described in Chapter 10 (Storage Methods...). With these classes, as with all Rogue Wave collection classes, you are responsible for the allocation and deallocation of the objects themselves.

Three vector-based generic collections use value-based semantics: RWGVector(val), RWGOrderedVector(val), and RWGSortedVector(val). These classes store the type itself,which could be a pointer to an object.

The storage and retrieval methods and criteria differ from class to class.