|
ALINK="#ff0000">
hash_multiset<Key, HashFcn, EqualKey, Alloc>
DescriptionHash_multiset is a Hashed Associative Container that stores objects of type Key. Hash_multiset is a simple associative container, meaning that its value type, as well as its key type, is Key. It is also a Multiple Associative Container, meaning that two or more elements may compare equal using the Binary Predicate EqualKey.Hash_multiset is useful in applications where it is important to be able to search for an element quickly. If it is important for the elements to be in a particular order, however, then multiset is more appropriate. Examplestruct eqstr { bool operator()(const char* s1, const char* s2) const { return strcmp(s1, s2) == 0; } }; void lookup(const hash_multiset<const char*, hash<const char*>, eqstr>& Set, const char* word) { int n_found = Set.count(word); cout << word << ": " << n_found << " " << (n_found == 1 ? "instance" : "instances") << endl; } int main() { hash_multiset<const char*, hash<const char*>, eqstr> Set; Set.insert("mango"); Set.insert("kiwi"); Set.insert("apple"); Set.insert("kiwi"); Set.insert("mango"); Set.insert("mango"); Set.insert("apricot"); Set.insert("banana"); Set.insert("mango"); lookup(Set, "mango"); lookup(Set, "apple"); lookup(Set, "durian"); } DefinitionDefined 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.Template parameters
Model ofMultiple Hashed Associative Container, Simple Associative ContainerType requirements
Public base classesNone.Members
New membersAll of hash_multiset's members are defined in the Multiple Hashed Associative Container and Simple Associative Container requirements. Hash_multiset does not introduce any new members.Notes[1] This member function relies on member template functions, which at present (early 1998) are not supported by all compilers. If your compiler supports member templates, you can call this function with any type of input iterator. If your compiler does not yet support member templates, though, then the arguments must either be of type const value_type* or of type hash_multiset::const_iterator. See alsoAssociative Container, Hashed Associative Container, Simple Associative Container, Multiple Hashed Associative Container, set, map, multiset, multimap, hash_set, hash_map, hash_multimapCopyright © 1999 Silicon Graphics, Inc. All Rights Reserved. TrademarkInformation
|