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 // <functional> 11 12 // template <class T> 13 // struct hash 14 // : public unary_function<T, size_t> 15 // { 16 // size_t operator()(T val) const; 17 // }; 18 19 // Not very portable 20 21 #include <thread> 22 #include <cassert> 23 main()24int main() 25 { 26 std::thread::id id1; 27 std::thread::id id2 = std::this_thread::get_id(); 28 typedef std::hash<std::thread::id> H; 29 H h; 30 assert(h(id1) != h(id2)); 31 } 32