[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / containers / test_compare.h
blob3ce680d03e73f136b49bbeda4c02136811ee6382
1 //===----------------------------------------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef TEST_COMPARE_H
10 #define TEST_COMPARE_H
12 #include <cstddef>
13 #include <type_traits>
14 #include <cstdlib>
15 #include <new>
16 #include <climits>
18 template <class C>
19 class test_compare
20 : private C
22 int data_;
23 public:
24 explicit test_compare(int data = 0) : data_(data) {}
26 typename C::result_type
27 operator()(typename std::add_lvalue_reference<const typename C::first_argument_type>::type x,
28 typename std::add_lvalue_reference<const typename C::second_argument_type>::type y) const
29 {return C::operator()(x, y);}
31 bool operator==(const test_compare& c) const
32 {return data_ == c.data_;}
36 template <class C>
37 class non_const_compare
39 // operator() deliberately not marked as 'const'
40 bool operator()(const C& x, const C& y) { return x < y; }
44 #endif // TEST_COMPARE_H