#include using namespace std; #include struct eqstr { bool operator()(const char* s1, const char* s2) const { return strcmp(s1, s2) == 0; } }; void lookup(const hash_set, eqstr>& Set, const char* word) { hash_set, eqstr>::const_iterator it = Set.find(word); cout << word << ": " << (it != Set.end() ? "present" : "not present") << endl; } int main() { string temp = "mango", temp2 = "mango"; hash_set, eqstr> Set; Set.insert("kiwi"); Set.insert("plum"); Set.insert("apple"); Set.insert(temp.c_str()); temp = "apricot"; Set.insert(temp.c_str()); Set.insert("banana"); cout << "Should find mango!" << endl; lookup(Set, temp2.c_str()); lookup(Set, "apple"); lookup(Set, "durian"); return 0; }