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_STD_FUNCTIONOBJECTS_REFWRAP_HELPER_CONCEPTS_H
10#define TEST_STD_FUNCTIONOBJECTS_REFWRAP_HELPER_CONCEPTS_H
11
12#include <concepts>
13#include <utility>
14
15// Equality
16
17template <typename T>
18concept HasEqualityOperatorWithInt = requires(T t, int i) {
19 { t.get() == i } -> std::convertible_to<bool>;
20};
21
22// Spaceship
23
24template <class T>
25concept BooleanTestableImpl = std::convertible_to<T, bool>;
26
27template <class T>
28concept BooleanTestable = BooleanTestableImpl<T> && requires(T&& t) {
29 { !std::forward<T>(t) } -> BooleanTestableImpl;
30};
31
32template <typename T>
33concept HasSpaceshipOperatorWithInt = requires(T t, int i) {
34 { t < i } -> BooleanTestable;
35 { i < t } -> BooleanTestable;
36};
37
38#endif // TEST_STD_FUNCTIONOBJECTS_REFWRAP_HELPER_CONCEPTS_H
39

source code of libcxx/test/std/utilities/function.objects/refwrap/refwrap.comparissons/helper_concepts.h