xref: /minix3/external/bsd/libc++/dist/libcxx/test/std/containers/test_hash.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc //===----------------------------------------------------------------------===//
2*0a6a1f1dSLionel Sambuc //
3*0a6a1f1dSLionel Sambuc //                     The LLVM Compiler Infrastructure
4*0a6a1f1dSLionel Sambuc //
5*0a6a1f1dSLionel Sambuc // This file is dual licensed under the MIT and the University of Illinois Open
6*0a6a1f1dSLionel Sambuc // Source Licenses. See LICENSE.TXT for details.
7*0a6a1f1dSLionel Sambuc //
8*0a6a1f1dSLionel Sambuc //===----------------------------------------------------------------------===//
9*0a6a1f1dSLionel Sambuc 
10*0a6a1f1dSLionel Sambuc #ifndef TEST_HASH_H
11*0a6a1f1dSLionel Sambuc #define TEST_HASH_H
12*0a6a1f1dSLionel Sambuc 
13*0a6a1f1dSLionel Sambuc #include <cstddef>
14*0a6a1f1dSLionel Sambuc #include <type_traits>
15*0a6a1f1dSLionel Sambuc 
16*0a6a1f1dSLionel Sambuc template <class C>
17*0a6a1f1dSLionel Sambuc class test_hash
18*0a6a1f1dSLionel Sambuc     : private C
19*0a6a1f1dSLionel Sambuc {
20*0a6a1f1dSLionel Sambuc     int data_;
21*0a6a1f1dSLionel Sambuc public:
data_(data)22*0a6a1f1dSLionel Sambuc     explicit test_hash(int data = 0) : data_(data) {}
23*0a6a1f1dSLionel Sambuc 
24*0a6a1f1dSLionel Sambuc     std::size_t
operator()25*0a6a1f1dSLionel Sambuc     operator()(typename std::add_lvalue_reference<const typename C::argument_type>::type x) const
26*0a6a1f1dSLionel Sambuc         {return C::operator()(x);}
27*0a6a1f1dSLionel Sambuc 
28*0a6a1f1dSLionel Sambuc     bool operator==(const test_hash& c) const
29*0a6a1f1dSLionel Sambuc         {return data_ == c.data_;}
30*0a6a1f1dSLionel Sambuc };
31*0a6a1f1dSLionel Sambuc 
32*0a6a1f1dSLionel Sambuc #endif  // TEST_HASH_H
33