lundi 28 janvier 2019

STL Type for mapping one-to-one relations?

when thinking about design decisions of my code regarding one-to-one relations I came to think about if I should use std::vector<std::pair<T1, T2>> instead of std::map<T1, T2>, and implement two methods A to B and B to A myself.

I can't use boost, so the answer to this question I found about it (One-to-one relation in STL terms) is not really fitting.

Is there some STL equivalent doing this job? Or do you think the vector is a bad idea? There won't be many entries in the struct ( < 10) but there will be a lot of access on it.

Aucun commentaire:

Enregistrer un commentaire