All pastes #276910 Raw Edit

o_O

public cpp v1 · immutable
·published 2006-12-12 19:59 UTC
rendered paste body
#include <iostream>using namespace std;#include <hash_set.h>struct eqstr{  bool operator()(const char* s1, const char* s2) const  {    return strcmp(s1, s2) == 0;  }};void lookup(const hash_set<const char*, hash<const char*>, eqstr>& Set,            const char* word){  hash_set<const char*, hash<const char*>, 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<const char*, hash<const char*>, 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;}