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 | { |
15 | int data_; |
16 | explicit test_equal_to() : data_(0) {} |
17 | explicit test_equal_to(int data) : data_(data) {} |
18 | bool operator()(const T& a, const T& b) const |
19 | { return a == b; } |
20 | friend bool operator==(const test_equal_to& a, const test_equal_to& b) |
21 | { return a.data_ == b.data_; } |
22 | }; |
23 | |
24 | template <class T> |
25 | struct test_less |
26 | { |
27 | int data_; |
28 | explicit test_less() : data_(0) {} |
29 | explicit test_less(int data) : data_(data) {} |
30 | bool operator()(const T& a, const T& b) const |
31 | { return a < b; } |
32 | friend bool operator==(const test_less& a, const test_less& b) |
33 | { return a.data_ == b.data_; } |
34 | }; |
35 | |
36 | #endif // TEST_COMPARE_H |
37 | |