//===----------------------------------------------------------------------===// // // 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), "" ); ASSERT_NOEXCEPT(H()(T())); H h; for (int i = 0; i <= 5; ++i) { T t(static_cast(i)); const bool small = std::integral_constant::value; // avoid compiler warnings if (small) { const std::size_t result = h(t); LIBCPP_ASSERT(result == static_cast(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 }