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 //===----------------------------------------------------------------------===//
13 // : public unary_function<T, size_t>
15 // size_t operator()(T val) const;
20 #include <type_traits>
22 #include "test_macros.h"
24 template <std::size_t N
>
28 typedef std::bitset
<N
> T
;
29 typedef std::hash
<T
> H
;
30 static_assert((std::is_same
<typename
H::argument_type
, T
>::value
), "" );
31 static_assert((std::is_same
<typename
H::result_type
, std::size_t>::value
), "" );
32 ASSERT_NOEXCEPT(H()(T()));
35 T
bs(static_cast<unsigned long long>(N
));
36 const std::size_t result
= h(bs
);
37 LIBCPP_ASSERT(result
== N
);
38 ((void)result
); // Prevent unused warning