Hi,
Is it possible to have a structure as a key in stl-map?
Let us consider the following declaration.
struct key {
int a;
int b;
};
struct compare {
bool operator()(const struct key k1, const struct key k2) const {
return ((k1->a < k2->a) && (k2->a < k2->b));
}
};
map<struct key, float, compare> mymap;
Is this declaration correct? will it work correctly?
Thanks for your response.
-Latha
Is it possible to have a structure as a key in stl-map?
Let us consider the following declaration.
struct key {
int a;
int b;
};
struct compare {
bool operator()(const struct key k1, const struct key k2) const {
return ((k1->a < k2->a) && (k2->a < k2->b));
}
};
map<struct key, float, compare> mymap;
Is this declaration correct? will it work correctly?
Thanks for your response.
-Latha