P
Paulo da Silva
Hi.
I have a class Foo with a string. I want to store its elements in a
hash_set beeing the hash executed over the string. How do I do that?
class Foo
{
...
string s;
...
};
....
hash_set<Foo> mc;
Foo mc_el("a_string_key");
What do I have to do in Foo and how do I insert mc_el in mc?
BTW, I never used hash_set before. So please forgive me if I am
misunderstanding something basic.
So far I used a hash_map<string,Foo>, mc["a_string_key"]=mc_el. I think
a better solution for this case should be a hash_set because the key is
inside the object. Am I wrong?
Thanks for any help.
I have a class Foo with a string. I want to store its elements in a
hash_set beeing the hash executed over the string. How do I do that?
class Foo
{
...
string s;
...
};
....
hash_set<Foo> mc;
Foo mc_el("a_string_key");
What do I have to do in Foo and how do I insert mc_el in mc?
BTW, I never used hash_set before. So please forgive me if I am
misunderstanding something basic.
So far I used a hash_map<string,Foo>, mc["a_string_key"]=mc_el. I think
a better solution for this case should be a hash_set because the key is
inside the object. Am I wrong?
Thanks for any help.