Value vs. Reference Semantics in Templates
The Essential Tools Module collection class templates can be either value-based or pointer-based. Value-based collections use
value semantics, maintaining copies of inserted objects and returning copies of retrieved objects. In contrast, pointer-based collections use
reference semantics, dealing with pointers to objects as opposed to the objects themselves. See
Storage Methods of Collection Classes for other examples of value and reference semantics.
Templates offer you a choice between value and reference semantics. In fact, in most cases, you must choose between a value-based or a pointer-based class; for example, either
RWTValOrderedVector<T,A>, or
RWTPtrOrderedVector<T,A>.
Your choice depends on the requirements of your application. Pointer-based templates are a good choice for maximizing efficiency for large objects, or if you need to have the same group of objects referred to in several ways, requiring that each collection class point to the target objects, rather than wholly contain them.