Categories: containers, functors | Component type: type |
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.
int main() { hash<const char*> H; cout << "foo -> " << H("foo") << endl; cout << "bar -> " << H("bar") << endl; }
Parameter | Description | Default |
---|---|---|
T | The argument type. That is, the type of object that is being hashed. |
Member | Where defined | Description |
---|---|---|
size_t operator()(const T& x) | Hash Function | Returns x's hash value. |
[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.
privacy policy | | | contact us |
Copyright © 1993-2001 Silicon Graphics, Inc. All rights reserved. | | | Trademark Information |