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 
17 template <typename T>
requires(T t,int i)18 concept HasEqualityOperatorWithInt = requires(T t, int i) {
19   { t.get() == i } -> std::convertible_to<bool>;
20 };
21 
22 // Spaceship
23 
24 template <class T>
25 concept BooleanTestableImpl = std::convertible_to<T, bool>;
26 
27 template <class T>
requires(T && t)28 concept BooleanTestable = BooleanTestableImpl<T> && requires(T&& t) {
29   { !std::forward<T>(t) } -> BooleanTestableImpl;
30 };
31 
32 template <typename T>
requires(T t,int i)33 concept 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