c++ - Is the default compare function is OK when we use the tuple as a key in std::map? -


i want create map map<tuple,vector<type>>. after going through suggestions design, found have implement hash<key> tuple (which key here) if container unordered_map, since tuples treated objects, left because mine map(am right?). ok leave compare function or need give custom implementation? if below fine?

struct key_comp {     bool operator<(attrib& l,attrib& r)     {         return ( l.a < r.a ) ||           (( l.a == r.a) && ( l.b < r.b ));     } }  using reqlist=map<const attrib,vector<req>,less<key_comp>>; // attrib tuple of (int,string,int) 


Comments