XXXX@XXXXX.COM (JZapin) wrote
The phrase "database" has more than one meaning. Normally when I hear
it I think of a persistent collection of data, organized for fast
retrieval of random elements. SQL Server, Oracle, even Microsoft Access.
This is the most usual definition of "database" but it normally isn't
handled with the STL at all.
You could also just mean a collection of data in memory; this type of
database starts empty, but populates while the program runs.
The third variation is a fusion of both methods; the database is kept
internally, but when the program exits it first writes out ALL of the
data to a file, and when the program starts up it reads ALL of the data
back in.
For both of the alternative meanings, the STL would be a fine way to
organize data in memory.
Look in to class map or multimap, depending on your data. One of these
should give you what you're after.
Note: With the STL it's important not to mix data types in the same
container. You cannot put an object of type Derived into a container
of type Base. You can create a container of pointers instead, if you
need to mix data types.
[ See
http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]