you could use an unsorted_map<std::pair<Faction*,Faction*>, FactionRelation>. And maybe add all relations in both directions.