jagguy said:
thanks for some of the tips.
A database is a container
Not really. A database is primarily a form of persistant storage. A
database will also come with methods to persist and to retrieve data,
which may include some "stored procedures", generally based on how the
database is going to store/retrieve compared to what it
receives/returns.
and most of the time rarely suffers huge
performance losses compared to reading all the data in some temperary
storage, manipulating it then writing back.
Temporary storage? How much data are we talking about?
A big database like the ones in SAP don't require C++.
Nothing "requires" C++. There are other programming languages. Many
databases come with a proprietary language usually based around SQL, eg
Transact and PL/SQL.
So the need to use a vector appear much less with databases around, so
that's why I ask .
vector is used for storage of sequences of data in memory in contiguous
storage. It is used for manipulating the data.
If your project is large scale where the database is used as a form of
persistent storage, and business logic is calculated with a C++ engine,
and possibly there is a client/server architecture whereby you are
writing middleware in C++ that is a client to the database and a server
to other clients, then it is just possible that your code will contain
some sort of logic which involves vectors.
If we know the database size to begin with and we want temperary storage
then an array will do full of object pointers if need be.
I just haven't seen anyone claim we just use a vector for database like
applications then write back to a file when finished with it all , as I have
asked around and it isn't a common problem by the looks of it.
If the database interaction requires you to pass a pointer to
contiguous data of a variable size then you will probably want to use
vector and pass the address of its first element. Your program will
then be able to manipulate your data to the required size without
having to worry about memory management issues.