DTH
DTH

Reputation: 1133

Alternative to 3 Synchronized CStringList's

I have 3 CStringList’s:

The lists are synchronized, which means that the value (found in parameterValueList) of a named parameter (found in parameterNameList) are located in the same position (index\POSITION) in their respective StringLists. The same goes for parameterID.

Im looking for an alternative to having 3 StringLists and thought about using a CMap with parameterID as key and create a class to hold name and value.

Question: What would be the best solution for replacing my 3 CStringList objects ?

Additional: The collection\list\map must be fairly easy to sort and be serializable

Upvotes: 0

Views: 114

Answers (1)

xMRi
xMRi

Reputation: 15375

Just use a std::map

struct DATA
{
    CString strName;
    CSTring strValue;    
};

typedef std::map<CString,DATA> MYDATAMAP;

It is sorted and easy to iterate. Createing a serializer is easy too.

Upvotes: 2

Related Questions