Implements https://wg21.link/P2944R3 (partially) Implements https://wg21.link/LWG4071 / https://cplusplus.github.io/LWG/issue4071 (fixes build failures in the test suite) - https://eel.is/c++draft/refwrap.comparisons
39 lines
1.1 KiB
C++
39 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_STD_FUNCTIONOBJECTS_REFWRAP_HELPER_CONCEPTS_H
|
|
#define TEST_STD_FUNCTIONOBJECTS_REFWRAP_HELPER_CONCEPTS_H
|
|
|
|
#include <concepts>
|
|
#include <utility>
|
|
|
|
// Equality
|
|
|
|
template <typename T>
|
|
concept HasEqualityOperatorWithInt = requires(T t, int i) {
|
|
{ t.get() == i } -> std::convertible_to<bool>;
|
|
};
|
|
|
|
// Spaceship
|
|
|
|
template <class T>
|
|
concept BooleanTestableImpl = std::convertible_to<T, bool>;
|
|
|
|
template <class T>
|
|
concept BooleanTestable = BooleanTestableImpl<T> && requires(T&& t) {
|
|
{ !std::forward<T>(t) } -> BooleanTestableImpl;
|
|
};
|
|
|
|
template <typename T>
|
|
concept HasSpaceshipOperatorWithInt = requires(T t, int i) {
|
|
{ t < i } -> BooleanTestable;
|
|
{ i < t } -> BooleanTestable;
|
|
};
|
|
|
|
#endif // TEST_STD_FUNCTIONOBJECTS_REFWRAP_HELPER_CONCEPTS_H
|