modify the object that it points to. Using the same notation as above,
[2] This member function relies on
Associative Container, Sorted Associative Container, Pair Associative Container, Multiple Sorted Associative Container,
hash_set<Key, HashFcn, EqualKey, Alloc>
Category: containers
Component type: type
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() {
hash_set<const char*, hash<const char*>, eqstr> Set;
Set.insert('kiwi');
Set.insert('plum');
Set.insert('apple');
Set.insert('mango');
Set.insert('apricot');
Set.insert('banana');
lookup(Set, 'mango');
lookup(Set, 'apple');
lookup(Set, 'durian');
}
Defined in the header hash_set, and in the backward-compatibility header hash_set.h. This class is an SGI extension; it is not part of the C++ standard.
| Parameter | Description | Default |
|---|---|---|
Key | The hash_set's key type and value type. This is also defined as | |
HashFcn | The Hash Function used by the hash_set. This is also defined as | hash<Key> |
EqualKey | The hash_set's key equality function: a binary predicate that determines whether two keys are equal. This is also defined as | equal_to<Key> |
Alloc | The | alloc |
Unique Hashed Associative Container, Simple Associative Container
None.
