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 | //===----------------------------------------------------------------------===// |
8 | |
9 | #ifndef TEST_COMPARE_H |
10 | #define TEST_COMPARE_H |
11 | |
12 | template <class T> |
13 | struct test_equal_to { |
14 | int data_; |
15 | explicit test_equal_to() : data_(0) {} |
16 | explicit test_equal_to(int data) : data_(data) {} |
17 | bool operator()(const T& a, const T& b) const { return a == b; } |
18 | friend bool operator==(const test_equal_to& a, const test_equal_to& b) { return a.data_ == b.data_; } |
19 | }; |
20 | |
21 | template <class T> |
22 | struct test_less { |
23 | int data_; |
24 | explicit test_less() : data_(0) {} |
25 | explicit test_less(int data) : data_(data) {} |
26 | bool operator()(const T& a, const T& b) const { return a < b; } |
27 | friend bool operator==(const test_less& a, const test_less& b) { return a.data_ == b.data_; } |
28 | }; |
29 | |
30 | #endif // TEST_COMPARE_H |
31 |