1//===----------------------------------------------------------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is dual licensed under the MIT and the University of Illinois Open 6// Source Licenses. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10// <memory> 11 12// template <class T> 13// struct hash<shared_ptr<T>> 14// { 15// typedef shared_ptr<T> argument_type; 16// typedef size_t result_type; 17// size_t operator()(const shared_ptr<T>& p) const; 18// }; 19 20#include <memory> 21#include <cassert> 22 23int main() 24{ 25 int* ptr = new int; 26 std::shared_ptr<int> p(ptr); 27 std::hash<std::shared_ptr<int> > f; 28 std::size_t h = f(p); 29 assert(h == std::hash<int*>()(ptr)); 30} 31