Hi guys,
I know what a vector and a list is?
I have this scenario and I want to know which will be best to use.
I have a class called "molecule". The maximum number of atoms a molecule can hold is 72. The number of atoms vary depending on the type of molecule, it can be 4 or 10 or 1 or 50 etc etc...upto maxatoms.
Hence, since the maximum number of atoms is fixed i.e 72, and for current molecule if the number of atoms is only 4, there are 68 vacant space empty.
A big "waste of space".
Also I want to randomly access the atoms, to test certain conditions.
Currently I use vector<molecule > but I think using vector can help me randomly access the atoms but eats up more memory. Dont you think?
So what do you think can be best "vector/list" for above discussed scenario.
Thanks in advance
I know what a vector and a list is?
I have this scenario and I want to know which will be best to use.
I have a class called "molecule". The maximum number of atoms a molecule can hold is 72. The number of atoms vary depending on the type of molecule, it can be 4 or 10 or 1 or 50 etc etc...upto maxatoms.
Hence, since the maximum number of atoms is fixed i.e 72, and for current molecule if the number of atoms is only 4, there are 68 vacant space empty.
A big "waste of space".
Also I want to randomly access the atoms, to test certain conditions.
Currently I use vector<molecule > but I think using vector can help me randomly access the atoms but eats up more memory. Dont you think?
So what do you think can be best "vector/list" for above discussed scenario.
Thanks in advance
Comment