I want to map a struct(key) to an int(value). Then I want to find a value given a key (struct).
typedef struct {
int a, b;
} TechId;
struct our_cmp {
bool operator() ( TechId a, TechId b ) const
{ return std::make_pair(a.a,a.b) > std::make_pair(b.a, b.b) ; }
};
int main() {
std::map<TechId, int, our_cmp> mymap;
TechId x;
if(mymap.find(x)) {
printf("found");
}
}
There is a find function but I guess it is only for string/ints etc? Is there a possibility to adapt it to my struct?