Anteckning
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Computes hash code for a value.
template<class Ty>
struct hash
: public unary_function<Ty, size_t> {
size_t operator()(Ty val) const;
};
Remarks
The member operator returns a hash code for val, suitable for use with template classes unordered_map, unordered_multimap, unordered_set, and unordered_multiset. Ty may be any scalar type, string, or wstring.
Example
// std_tr1__functional__hash.cpp
// compile with: /EHsc
#include <functional>
#include <iostream>
#include <unordered_set>
int main()
{
std::tr1::unordered_set<int, std::tr1::hash<int> > c0;
c0.insert(3);
std::cout << *c0.find(3) << std::endl;
return (0);
}
3
Requirements
Header: <functional>
Namespace: std::tr1