xref: /minix3/external/bsd/libc++/dist/libcxx/test/std/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 
10*0a6a1f1dSLionel Sambuc #ifndef TEST_COMPARE_H
11*0a6a1f1dSLionel Sambuc #define TEST_COMPARE_H
12*0a6a1f1dSLionel Sambuc 
13*0a6a1f1dSLionel Sambuc #include <cstddef>
14*0a6a1f1dSLionel Sambuc #include <type_traits>
15*0a6a1f1dSLionel Sambuc #include <cstdlib>
16*0a6a1f1dSLionel Sambuc #include <new>
17*0a6a1f1dSLionel Sambuc #include <climits>
18*0a6a1f1dSLionel Sambuc 
19*0a6a1f1dSLionel Sambuc template <class C>
20*0a6a1f1dSLionel Sambuc class test_compare
21*0a6a1f1dSLionel Sambuc     : private C
22*0a6a1f1dSLionel Sambuc {
23*0a6a1f1dSLionel Sambuc     int data_;
24*0a6a1f1dSLionel Sambuc public:
data_(data)25*0a6a1f1dSLionel Sambuc     explicit test_compare(int data = 0) : data_(data) {}
26*0a6a1f1dSLionel Sambuc 
27*0a6a1f1dSLionel Sambuc     typename C::result_type
operator()28*0a6a1f1dSLionel Sambuc     operator()(typename std::add_lvalue_reference<const typename C::first_argument_type>::type x,
29*0a6a1f1dSLionel Sambuc                typename std::add_lvalue_reference<const typename C::second_argument_type>::type y) const
30*0a6a1f1dSLionel Sambuc         {return C::operator()(x, y);}
31*0a6a1f1dSLionel Sambuc 
32*0a6a1f1dSLionel Sambuc     bool operator==(const test_compare& c) const
33*0a6a1f1dSLionel Sambuc         {return data_ == c.data_;}
34*0a6a1f1dSLionel Sambuc };
35*0a6a1f1dSLionel Sambuc 
36*0a6a1f1dSLionel Sambuc #endif  // TEST_COMPARE_H
37