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 // <unordered_map> 11 12 // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, 13 // class Alloc = allocator<pair<const Key, T>>> 14 // class unordered_map 15 // { 16 // public: 17 // // types 18 // typedef Key key_type; 19 // typedef T mapped_type; 20 // typedef Hash hasher; 21 // typedef Pred key_equal; 22 // typedef Alloc allocator_type; 23 // typedef pair<const key_type, mapped_type> value_type; 24 // typedef value_type& reference; 25 // typedef const value_type& const_reference; 26 // typedef typename allocator_traits<allocator_type>::pointer pointer; 27 // typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; 28 // typedef typename allocator_traits<allocator_type>::size_type size_type; 29 // typedef typename allocator_traits<allocator_type>::difference_type difference_type; 30 31 #include <unordered_map> 32 #include <type_traits> 33 34 int main() 35 { 36 { 37 typedef std::unordered_map<char, short> C; 38 static_assert((std::is_same<C::key_type, char>::value), ""); 39 static_assert((std::is_same<C::mapped_type, short>::value), ""); 40 static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), ""); 41 static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), ""); 42 static_assert((std::is_same<C::allocator_type, std::allocator<C::value_type> >::value), ""); 43 static_assert((std::is_same<C::value_type, std::pair<const C::key_type, C::mapped_type> >::value), ""); 44 static_assert((std::is_same<C::reference, C::value_type&>::value), ""); 45 static_assert((std::is_same<C::const_reference, const C::value_type&>::value), ""); 46 static_assert((std::is_same<C::pointer, C::value_type*>::value), ""); 47 static_assert((std::is_same<C::const_pointer, const C::value_type*>::value), ""); 48 static_assert((std::is_same<C::size_type, std::size_t>::value), ""); 49 static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), ""); 50 } 51 } 52