xref: /minix3/external/bsd/libc++/dist/libcxx/test/containers/test_compare.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_COMPARE_H
114684ddb6SLionel Sambuc #define TEST_COMPARE_H
124684ddb6SLionel Sambuc 
134684ddb6SLionel Sambuc #include <cstddef>
144684ddb6SLionel Sambuc #include <type_traits>
154684ddb6SLionel Sambuc #include <cstdlib>
164684ddb6SLionel Sambuc #include <new>
174684ddb6SLionel Sambuc #include <climits>
184684ddb6SLionel Sambuc 
194684ddb6SLionel Sambuc template <class C>
204684ddb6SLionel Sambuc class test_compare
214684ddb6SLionel Sambuc     : private C
224684ddb6SLionel Sambuc {
234684ddb6SLionel Sambuc     int data_;
244684ddb6SLionel Sambuc public:
data_(data)254684ddb6SLionel Sambuc     explicit test_compare(int data = 0) : data_(data) {}
264684ddb6SLionel Sambuc 
274684ddb6SLionel Sambuc     typename C::result_type
operator()284684ddb6SLionel Sambuc     operator()(typename std::add_lvalue_reference<const typename C::first_argument_type>::type x,
294684ddb6SLionel Sambuc                typename std::add_lvalue_reference<const typename C::second_argument_type>::type y) const
304684ddb6SLionel Sambuc         {return C::operator()(x, y);}
314684ddb6SLionel Sambuc 
324684ddb6SLionel Sambuc     bool operator==(const test_compare& c) const
334684ddb6SLionel Sambuc         {return data_ == c.data_;}
344684ddb6SLionel Sambuc };
354684ddb6SLionel Sambuc 
364684ddb6SLionel Sambuc #endif  // TEST_COMPARE_H
37