dictionary - c++ using structs as data for a <map, <map, vector>> -
i having problem trying load map has map/vector combination value structs. below code have tried simplify as could:
//these structs struct order { std::string a; std::string b; }; struct card { std::string c; std::string d; }; struct item { std::string e; std::string f; }; //this method read , load map void loadmap(listofvalues object) { std::map<order, std::map<item, std::vector<card>>> records; //this data structure i'm trying store //listofvalues list passed holds these values need put map for(std::vector<listofvalues>::iterator viter= object.begin(); viter != object.end(); ++viter) { std::string sreceiptrecord = (*viter).getreceipt(m_stdorderconfirmver); order order = {(*viter).geta,(*viter).getb}; item item = {(*viter).getc,(*viter).getd}; card card = {wws::string((*viter).gete), (*viter).getf}; records[order][item].push_back(card); //load map } }
so have object passed contains list of values (listofvalues). iterate through list , getter methods, store values structs (gete returns long why conversion necessary). there step i'm missing
an error i'm getting is:
error c2678: binary '<' : no operator found takes left-hand operand of type 'const order' (or there no acceptable conversion)
you need provide operator < struct used key map, see question: struct key in std::map
Comments
Post a Comment