dictionary - How to share the key across the different map in c++? -
i'm working on map, stored data 2 different map(it nested map) having same key, way store data single ds rather 2 different nested maps. following 2 nested maps:
std::map<keystruct, std::map<classobjsharedptr, std::set<classobjsharedptr> > > map1; std::map<keystruct, std::map<classobjsharedptr, std::set<classobjsharedptr> > > map2;
here map1 , map2 have same key values.
i have maintained 2 different maps specific purpose. can store both maps in single ds? each key (i.e. each key have 2 internal map).
why not use single std::map
required data?
example code
struct data { std::map<classobjsharedptr, std::set<classobjsharedptr> > mdata1; std::map<classobjsharedptr, std::set<classobjsharedptr> > mdata2; }; std::map<keystruct, data> mmapdata;