llvm-project/libcxx/test/std/containers/test_compare.h
Arthur O'Dwyer 5cc55fdb57 [libc++] [test] Update "test_compare.h" users to avoid removed-in-C++20 members. NFCI.
Drive-by minor improvements to a couple of uses of min_pointer.

Differential Revision: https://reviews.llvm.org/D103366
2021-05-29 16:54:24 -04:00

37 lines
1.1 KiB
C++

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef TEST_COMPARE_H
#define TEST_COMPARE_H
template <class T>
struct test_equal_to
{
int data_;
explicit test_equal_to() : data_(0) {}
explicit test_equal_to(int data) : data_(data) {}
bool operator()(const T& a, const T& b) const
{ return a == b; }
friend bool operator==(const test_equal_to& a, const test_equal_to& b)
{ return a.data_ == b.data_; }
};
template <class T>
struct test_less
{
int data_;
explicit test_less() : data_(0) {}
explicit test_less(int data) : data_(data) {}
bool operator()(const T& a, const T& b) const
{ return a < b; }
friend bool operator==(const test_less& a, const test_less& b)
{ return a.data_ == b.data_; }
};
#endif // TEST_COMPARE_H