A template for storing (owning pointers to) objects by integer ids
Documentation
A template for storing (owning pointers to) objects by integer ids
Inheritance:
ObjectStorer
Public Methods
int
add (T* p) Add a new object, get back its assigned id.
void
remove (int p) Mark the object with the given id for removal
T*
get (int p) Get the pointer corresponding to the given id
T*
get_allowNull (int p) Get the pointer corresponding to the given id
T*
operator[] (int p) Alias to get()
int add(T* p)
Add a new object, get back its assigned id.
Side effect: all object marked for removal
since the last add() are really deleted.
The ObjectStorer takes ownership of the pointer
and will eventually delete() it.