//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // 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(int, char**) { 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 return 0; }