K
kietzi
Hello world,
I was wondering whether it would be possible to create a map which uses
a pair of ints as key and a float as value. I have used maps with const
char*[] as key, but have so far not been successful to use a version
which uses pairs as keys.
For instance, I would like to set up the map as follows:
struct eqstr {
bool operator()(pair<int,int> s1, pair<int,int> s2) const{
return ((s1.first==s2.first) && (s1.second==s2.second));
}
};
std::map<std:
air<int,int>*, float, hash<const char*>, eqstr>
connections;
Unforunately, this does not work. How would I put elements into the map
and how could I access them? Where could be the problem with the eqstr
struct and map-initialization?
Thanks a lot you guys...
Tim
I was wondering whether it would be possible to create a map which uses
a pair of ints as key and a float as value. I have used maps with const
char*[] as key, but have so far not been successful to use a version
which uses pairs as keys.
For instance, I would like to set up the map as follows:
struct eqstr {
bool operator()(pair<int,int> s1, pair<int,int> s2) const{
return ((s1.first==s2.first) && (s1.second==s2.second));
}
};
std::map<std:
connections;
Unforunately, this does not work. How would I put elements into the map
and how could I access them? Where could be the problem with the eqstr
struct and map-initialization?
Thanks a lot you guys...
Tim