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 // <typeindex>
11 
12 // struct hash<type_index>
13 //     : public unary_function<type_index, size_t>
14 // {
15 //     size_t operator()(type_index index) const;
16 // };
17 
18 #include <typeindex>
19 #include <type_traits>
20 
21 #include "test_macros.h"
22 #if TEST_STD_VER >= 11
23 #include "poisoned_hash_helper.hpp"
24 #endif
25 
main()26 int main()
27 {
28   {
29     typedef std::hash<std::type_index> H;
30     static_assert((std::is_same<typename H::argument_type, std::type_index>::value), "" );
31     static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
32   }
33 #if TEST_STD_VER >= 11
34   {
35     test_hash_enabled_for_type<std::type_index>(std::type_index(typeid(int)));
36   }
37 #endif
38 }
39