Ok, im setting up a really basic example agenda which has the following characteristics and behaves like this:
It will be a group of astronauts (class astronaut), that can travel from the earth to the moon and to mars, etc. Then i would like to write down the different periods(class) in which each astronaut is in each celestial body. So the agenda would have a separate text file to store the data. The following is the period and astronaut classes and what could be an example of someone using the agenda:
class astronaut
{
int id;
date bday;
vector<period> V; or list<period> L;
bool he_dead;
}
class period
{
int CelestialBody; //0 for earth, 1 for moon, 2 for mars, etc.
int Establishment;
int Duty;
date EndDate;
}
Example of someone using it:
open program
add_astronaut(01/01/2013)
close program
open program
select astronaut from list
end_period(Earth, 01/07/2013)
close program
open program
select astronaut from list
end_period(Mars, 01/01/2014)
close program
open program
select astronaut from list
end_period(Earth, 01/07/2014)
he_dead()
close program
OK, wrapping up, the idea is that you never delete any astronaut nor any data from the text file, its a register, all the deletion that happens is the program clearing its memory before closing, and after saving to the .txt. Also, there will be times in which some other fields will be left blank, for future completion.
The question is then, whats better, a list of astronauts where every astronaut has a vector of periods, or a vector of astronauts where every astronaut has a list of periods?
I'm new to the STL and some background justification would be appreciated in respect to memory management concerns.