types.pass.cpp revision b64f8b07c104c6cc986570ac8ee0ed16a9f23976
1d2014649e0fc3c630c7530f6da060618c789d78dMichael Ilseman//===----------------------------------------------------------------------===// 2d2014649e0fc3c630c7530f6da060618c789d78dMichael Ilseman// 3d2014649e0fc3c630c7530f6da060618c789d78dMichael Ilseman// The LLVM Compiler Infrastructure 4d2014649e0fc3c630c7530f6da060618c789d78dMichael Ilseman// 5d2014649e0fc3c630c7530f6da060618c789d78dMichael Ilseman// This file is dual licensed under the MIT and the University of Illinois Open 6d2014649e0fc3c630c7530f6da060618c789d78dMichael Ilseman// Source Licenses. See LICENSE.TXT for details. 7d2014649e0fc3c630c7530f6da060618c789d78dMichael Ilseman// 8d2014649e0fc3c630c7530f6da060618c789d78dMichael Ilseman//===----------------------------------------------------------------------===// 9d2014649e0fc3c630c7530f6da060618c789d78dMichael Ilseman 1036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines// <unordered_map> 1136b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines 1236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, 1336b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines// class Alloc = allocator<pair<const Key, T>>> 14d2014649e0fc3c630c7530f6da060618c789d78dMichael Ilseman// class unordered_map 15d2014649e0fc3c630c7530f6da060618c789d78dMichael Ilseman// { 16d2014649e0fc3c630c7530f6da060618c789d78dMichael Ilseman// public: 17674be02d525d4e24bc6943ed9274958c580bcfbcJakub Staszak// // types 18674be02d525d4e24bc6943ed9274958c580bcfbcJakub Staszak// typedef Key key_type; 19d2014649e0fc3c630c7530f6da060618c789d78dMichael Ilseman// typedef T mapped_type; 20d2014649e0fc3c630c7530f6da060618c789d78dMichael Ilseman// typedef Hash hasher; 214c8f2dd6ab5b877de63568b56d542f845a8a3ca8Michael Ilseman// typedef Pred key_equal; 224c8f2dd6ab5b877de63568b56d542f845a8a3ca8Michael Ilseman// typedef Alloc allocator_type; 234c8f2dd6ab5b877de63568b56d542f845a8a3ca8Michael Ilseman// typedef pair<const key_type, mapped_type> value_type; 244c8f2dd6ab5b877de63568b56d542f845a8a3ca8Michael Ilseman// typedef value_type& reference; 25d2014649e0fc3c630c7530f6da060618c789d78dMichael Ilseman// typedef const value_type& const_reference; 26b55462bcfb9acbf8654dff83159daf695dfc3ec4Michael Ilseman// typedef typename allocator_traits<allocator_type>::pointer pointer; 27b55462bcfb9acbf8654dff83159daf695dfc3ec4Michael Ilseman// typedef typename allocator_traits<allocator_type>::const_pointer const_pointer; 28b55462bcfb9acbf8654dff83159daf695dfc3ec4Michael Ilseman// typedef typename allocator_traits<allocator_type>::size_type size_type; 2936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines// typedef typename allocator_traits<allocator_type>::difference_type difference_type; 3036b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines 31b55462bcfb9acbf8654dff83159daf695dfc3ec4Michael Ilseman#include <unordered_map> 32b55462bcfb9acbf8654dff83159daf695dfc3ec4Michael Ilseman#include <type_traits> 33b55462bcfb9acbf8654dff83159daf695dfc3ec4Michael Ilseman 34b55462bcfb9acbf8654dff83159daf695dfc3ec4Michael Ilsemanint main() 3516514de50a7936950845a3851cae8ce571e0c2c2Michael Ilseman{ 3616514de50a7936950845a3851cae8ce571e0c2c2Michael Ilseman { 3716514de50a7936950845a3851cae8ce571e0c2c2Michael Ilseman typedef std::unordered_map<char, short> C; 3836b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines static_assert((std::is_same<C::key_type, char>::value), ""); 3936b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines static_assert((std::is_same<C::mapped_type, short>::value), ""); 4016514de50a7936950845a3851cae8ce571e0c2c2Michael Ilseman static_assert((std::is_same<C::hasher, std::hash<C::key_type> >::value), ""); 4116514de50a7936950845a3851cae8ce571e0c2c2Michael Ilseman static_assert((std::is_same<C::key_equal, std::equal_to<C::key_type> >::value), ""); 42d2014649e0fc3c630c7530f6da060618c789d78dMichael Ilseman static_assert((std::is_same<C::allocator_type, std::allocator<C::value_type> >::value), ""); 43d2014649e0fc3c630c7530f6da060618c789d78dMichael Ilseman static_assert((std::is_same<C::value_type, std::pair<const C::key_type, C::mapped_type> >::value), ""); 44b3201c5cf1e183d840f7c99ff779d57f1549d8e5Pedro Artigas static_assert((std::is_same<C::reference, C::value_type&>::value), ""); 4536b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines static_assert((std::is_same<C::const_reference, const C::value_type&>::value), ""); 4636b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines static_assert((std::is_same<C::pointer, C::value_type*>::value), ""); 4736b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines static_assert((std::is_same<C::const_pointer, const C::value_type*>::value), ""); 48b3201c5cf1e183d840f7c99ff779d57f1549d8e5Pedro Artigas static_assert((std::is_same<C::size_type, std::size_t>::value), ""); 49b3201c5cf1e183d840f7c99ff779d57f1549d8e5Pedro Artigas static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), ""); 50b3201c5cf1e183d840f7c99ff779d57f1549d8e5Pedro Artigas } 51b3201c5cf1e183d840f7c99ff779d57f1549d8e5Pedro Artigas} 5236b56886974eae4f9c5ebc96befd3e7bfe5de338Stephen Hines