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
12template <class T>
13struct 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
21template <class T>
22struct 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

Provided by KDAB

Privacy Policy
Improve your Profiling and Debugging skills
Find out more

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