All of hash_multimap's members are defined in the Multiple Hashed Associative Container and Pair Associative Container requirements. Hash_multimap does not introduce any new members.
Notes [1] Hash_multimap::iterator is not a mutable iterator, because hash_multimap::value_type is not Assignable. That is, if i is of type hash_multimap::iterator and p is of type hash_multimap::value_type, then *i = p is not a valid expression. However, hash_multimap::iterator isn't a constant iterator either, because it can be used to modify the object that it points to. Using the same notation as above, (*i).second = p is a valid expression.
[2] 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_multimap::const_iterator.
See also Associative Container, Hashed Associative Container, Pair Associative Container, Multiple Hashed Associative Container, set, map, multiset, multimap, hash_set, hash_map, hash_multiset
Categories: containers, functors
Component type: type
Description The function object hash<T> is a Hash Function; it is used as the default hash function by all of the Hashed Associative Containers that are included in the STL.
The hash<T> template is only defined for template arguments of type char*, const char*, crope, wrope, and the built-in integral types. [1] If you need a Hash Function with a different argument type, you must either provide your own template specialization or else use a different Hash Function.
Example int main() {
hash<const char*> H;
cout << 'foo –> ' << H('foo') << endl;
cout << 'bar –> ' << H('bar') << endl;
}
Definition Defined in the headers hash_map and hash_set, and in the backward-compatibility headers hash_map.h and hash_set.h. This class is an SGI extension; it is not part of the C++ standard.
Template parameters | Parameter | Description |
T | The argument type. That is, the type of object that is being hashed. |
Model of Hash Function
Type requirements T must be a type for which a specialization of hash has been defined. The STL defines the following specializations:
• char*
• const char*
• crope
• wrope
• char
• signed char
• unsigned char
• short
• unsigned short
• int
• unsigned int
• long
• unsigned long
Public base classes None.
Members | Member | Where defined | Description |
size_t operator()(const T& x) | Hash Function | Returns x's hash value. |
New members All of hash's members are defined in the Hash Function requirements. Hash does not introduce any new members.
Notes [1] Technically, what this means is that the actual template hash<T> is an empty class; the member function operator() is defined only in the various specializations.
See also Hashed Associative Container, Hash Function