xref: /minix3/external/bsd/libc++/dist/libcxx/test/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 
104684ddb6SLionel Sambuc #ifndef TEST_HASH_H
114684ddb6SLionel Sambuc #define TEST_HASH_H
124684ddb6SLionel Sambuc 
134684ddb6SLionel Sambuc #include <cstddef>
144684ddb6SLionel Sambuc #include <type_traits>
154684ddb6SLionel Sambuc 
164684ddb6SLionel Sambuc template <class C>
174684ddb6SLionel Sambuc class test_hash
184684ddb6SLionel Sambuc     : private C
194684ddb6SLionel Sambuc {
204684ddb6SLionel Sambuc     int data_;
214684ddb6SLionel Sambuc public:
data_(data)224684ddb6SLionel Sambuc     explicit test_hash(int data = 0) : data_(data) {}
234684ddb6SLionel Sambuc 
244684ddb6SLionel Sambuc     std::size_t
operator()254684ddb6SLionel Sambuc     operator()(typename std::add_lvalue_reference<const typename C::argument_type>::type x) const
264684ddb6SLionel Sambuc         {return C::operator()(x);}
274684ddb6SLionel Sambuc 
284684ddb6SLionel Sambuc     bool operator==(const test_hash& c) const
294684ddb6SLionel Sambuc         {return data_ == c.data_;}
304684ddb6SLionel Sambuc };
314684ddb6SLionel Sambuc 
324684ddb6SLionel Sambuc #endif  // TEST_HASH_H
33