mardi 30 mai 2017

easiest way to have function of a map but that is ordered

I am trying to obtain an easy way to create something that functions like a vector of maps, that when I insert a key-value pair, it is not ordered when I put it in. I am creating a class as follows...

class Attributes: public vector<map<string,string>>
{
    public:

    private:

};

#endif

I will put a map of a string to a string to it, and then put more mappings in it. I put them in order. The problem, is that when I try to output these, they are in order.

For example, this output that looks like...

sibling1(c,b,a)? Yes(2) a='dad', b='Asher', c='Gad' a='pad', b='Gad', c='Naphtali'

should look like...

sibling1(c,b,a)? Yes(2) c='Gad', b='Asher', a='dad', c='Naphtali',b='Gad', a='pad'

I don't want a vector of vectors of strings because that messes up my easy way to look up these things for later. Again, please think of the Easiest way to change this, if possible. Thank you.

Aucun commentaire:

Enregistrer un commentaire