M
Mike Copeland
I have a data structure (similar to the one below) that contains a
variety of data types, and I wish to store many objects of this type in
a container that (1) allows fast retrieval access and (2) is reasonably
easy to store and update. Its "access key" is an integer value (e.g.
bibNum).
It seems that a vector is my best choice here (fast direct access via
the key and ease of storage), but map could be better - true? Are there
guidelines for container selection that could help me decide, or is some
other container type a better choice? Pleas advise. TIA
struct FD_TYPE // .FIN/.CFF file data
{
int bibNum; // Bib #
int finTime; // Finish Time
short entDivNum; // Division
short divFinPos; // division Finish Position
short evtFinPos; // Event Finish Position
char entGender; // Sex
char phaseNum; // Phase #
short entAge; // Age
char rCode; // RCode
char entType; // Entrant Type
short numLaps; // # of Laps
short waveNum; // Wave #
char teamTypeCode; // Team Type Code
short evtYear; // Event Year
short penalty; // Penalty
bool bOK; // usage flag
string teamName; // Team name (or "NONE")
string entName; // Entrant Name
} extern FinData;
variety of data types, and I wish to store many objects of this type in
a container that (1) allows fast retrieval access and (2) is reasonably
easy to store and update. Its "access key" is an integer value (e.g.
bibNum).
It seems that a vector is my best choice here (fast direct access via
the key and ease of storage), but map could be better - true? Are there
guidelines for container selection that could help me decide, or is some
other container type a better choice? Pleas advise. TIA
struct FD_TYPE // .FIN/.CFF file data
{
int bibNum; // Bib #
int finTime; // Finish Time
short entDivNum; // Division
short divFinPos; // division Finish Position
short evtFinPos; // Event Finish Position
char entGender; // Sex
char phaseNum; // Phase #
short entAge; // Age
char rCode; // RCode
char entType; // Entrant Type
short numLaps; // # of Laps
short waveNum; // Wave #
char teamTypeCode; // Team Type Code
short evtYear; // Event Year
short penalty; // Penalty
bool bOK; // usage flag
string teamName; // Team name (or "NONE")
string entName; // Entrant Name
} extern FinData;