I want a global bag that I can throw things into
and then take them out later.
The simplest contatiner that I can imagine.
(OK, surely there are simpler ones).
I want to put things into this bag in phase 1.
I will then read things from this bag in phase 2.
Write once. Read once. I don't care about
efficiency (spped or memory). I just
want the simplest/cleanest interface.
Should I build my own container class on top of
one of STL's containter classes?
My gut feel is that this ought to be one line in my .h
file, soemthing like:
extern slist<ObjectClass> ObjectContainer;
and a line in a .cc file, something like:
Possibly with an initialization to a null slist somewhere.
Then, in phase 1, I use: ObjectContainer.pushback( ken) to put ken in. And, in phase 2, I use
an ObjectContainer iterator along with
ObjectContainer.begin(), .next() and .end()
to read out all the objects.
Am I mising something?