What collection method will store the pair (key and value), where the key is not unique (which does not technically make it key, I think)?
Somewhere in my program, I:
typedef struct { int nKey; string strFormType; } KeyPair;
Then I will store the objects in the vector using this structure.
vector<KeyPair> vKeyList; KeyPair MenuOne; MenuOne.nKey = 1; MenuOne.strFormType = "Window"; vKeyList.push_back(MenuOne); MenuOne.nKey = 0; MenuOne.strFormType = "Window2"; vKeyList.push_back(MenuOne); MenuOne.nKey = 1; MenuOne.strFormType = "WindowC"; vKeyList.push_back(MenuOne);
This is basically how I want to store objects in a vector. My problem is that if I store as one hundred KeyPairs, I have to do it in a loop and just read KeyPairs from the repository, and then push_back is a vector.
What if I have to store these KeyPairs:
KEY WINDOW 1 Window 0 Window2 1 WindowC 3 Windowfoo 1 Window and so on...
I could not store it on the card, because you must have a unique key. The KeyPairs keys that I have are not unique. Any suggestion?
source share