//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // template // struct hash // : public unary_function // { // size_t operator()(T val) const; // }; #include #include #include #include #include #include "test_macros.h" template void test() { typedef std::hash H; static_assert((std::is_same::value), "" ); static_assert((std::is_same::value), "" ); H h; for (int i = 0; i <= 5; ++i) { T t(static_cast(i)); if (sizeof(T) <= sizeof(std::size_t)) { const std::size_t result = h(t); LIBCPP_ASSERT(result == t); ((void)result); // Prevent unused warning } } } int main() { test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); // LWG #2119 test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); #ifndef _LIBCPP_HAS_NO_INT128 test<__int128_t>(); test<__uint128_t>(); #endif }