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

source code of libcxx/test/std/containers/test_compare.h