When an object is allocated off the heap, who is responsible for deleting it? With some libraries, ownership can be a problem.
Most of the Rogue Wave classes take a very simple approach: if you allocate something off the heap, then you are responsible for deallocating it. If the Rogue Wave library allocates something off the heap, then it is responsible for deallocating it.
There are two exceptions for creation of objects. The first exception involves the operators:
RWFile& operator>>(RWFile& file, RWCollectable*&); Rwvistream& operator>>(RWvistream& vstream, RWCollectable*&);
These operators restore an object inheriting from RWCollectable from an RWFile or RWvistream, respectively. They return a pointer to an object allocated off the heap: you are responsible for deleting it.
The second exception is member function:
RWCollection* RWCollection::select(RWtestCollectable, void*)const;
This function returns a pointer to a collection, allocated off the heap, with members satisfying some selection criterion. Again, you are responsible for deleting this collection when you are done with it.
There is also an exception for object deletion: As a service, many of the collection classes provide a method, clearAndDestroy(), which will remove all pointers from the collection and delete each. Even with clearAndDestroy(), however, it is still your responsibility to know that it is safe to delete all the pointers in that collection.
These methods are documented in detail in the Class Reference.