I am using std::unordered_map with custom classes as shown below. I have correctly initialised and set up the hasher function. What I want to know is how to use the find function and what will it return? I am confused as the reference doc says that for the unordered_map the value acts as the key.
SO was wondering what the iterator would point to in the case of below find function
class xyz {
public:
int x;
int y;
int z;
//Required stuff
.
.
.
}
// Required Stuff
.
.
.
int main()
{
std::unordered_map<class xyz, std::string, KeyHasher> dummy = {
{ {10, 11, 12}, "example"},
{ {2, 3, 21}, "another"}
};
std::unordered_map<xyz, std::string, keyHasher>::const_iterator got = dummy.find({2, 3, 21});
//What will find return here? Is it the pointer to string "another"?
}
I have referred the following for basic setup of the custom classes. C++ unordered_map using a custom class type as the key
http://www.cplusplus.com/reference/unordered_set/unordered_set/find/