1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
14 // size_t operator()(T val) const;
21 #include <type_traits>
23 #include "test_macros.h"
27 typedef std::hash
<T
> H
;
28 #if TEST_STD_VER <= 14
29 static_assert((std::is_same
<typename
H::argument_type
, T
>::value
), "");
30 static_assert((std::is_same
<typename
H::result_type
, std::size_t>::value
), "");
32 ASSERT_NOEXCEPT(H()(T()));
35 std::string g1
= "1234567890";
36 std::string g2
= "1234567891";
37 T
s1(g1
.begin(), g1
.end());
38 T
s2(g2
.begin(), g2
.end());
39 assert(h(s1
) != h(s2
));
42 int main(int, char**) {
44 #ifndef TEST_HAS_NO_CHAR8_T
45 test
<std::u8string
>();
47 test
<std::u16string
>();
48 test
<std::u32string
>();
49 #ifndef TEST_HAS_NO_WIDE_CHARACTERS