1*96dbdd75SChristopher Di Bella //===----------------------------------------------------------------------===// 2*96dbdd75SChristopher Di Bella // 3*96dbdd75SChristopher Di Bella // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*96dbdd75SChristopher Di Bella // See https://llvm.org/LICENSE.txt for license information. 5*96dbdd75SChristopher Di Bella // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*96dbdd75SChristopher Di Bella // 7*96dbdd75SChristopher Di Bella //===----------------------------------------------------------------------===// 8*96dbdd75SChristopher Di Bella 9*96dbdd75SChristopher Di Bella // UNSUPPORTED: c++03, c++11, c++14, c++17 10*96dbdd75SChristopher Di Bella 11*96dbdd75SChristopher Di Bella // template<class F, class... Args> 12*96dbdd75SChristopher Di Bella // concept relation; 13*96dbdd75SChristopher Di Bella 14*96dbdd75SChristopher Di Bella #include <concepts> 15*96dbdd75SChristopher Di Bella 16*96dbdd75SChristopher Di Bella static_assert(std::relation<bool(int, int), int, int>); 17*96dbdd75SChristopher Di Bella static_assert(std::relation<bool(int, int), double, double>); 18*96dbdd75SChristopher Di Bella static_assert(std::relation<bool(int, double), double, double>); 19*96dbdd75SChristopher Di Bella 20*96dbdd75SChristopher Di Bella static_assert(!std::relation<bool(), int, double>); 21*96dbdd75SChristopher Di Bella static_assert(!std::relation<bool(int), int, double>); 22*96dbdd75SChristopher Di Bella static_assert(!std::relation<bool(double), int, double>); 23*96dbdd75SChristopher Di Bella static_assert(!std::relation<bool(double, double*), double, double*>); 24*96dbdd75SChristopher Di Bella static_assert(!std::relation<bool(int&, int&), double&, double&>); 25*96dbdd75SChristopher Di Bella 26*96dbdd75SChristopher Di Bella struct S1 {}; 27*96dbdd75SChristopher Di Bella static_assert(std::relation<bool (S1::*)(S1*), S1*, S1*>); 28*96dbdd75SChristopher Di Bella static_assert(std::relation<bool (S1::*)(S1&), S1&, S1&>); 29*96dbdd75SChristopher Di Bella 30*96dbdd75SChristopher Di Bella struct S2 {}; 31*96dbdd75SChristopher Di Bella 32*96dbdd75SChristopher Di Bella struct P1 { 33*96dbdd75SChristopher Di Bella bool operator()(S1, S1) const; 34*96dbdd75SChristopher Di Bella }; 35*96dbdd75SChristopher Di Bella static_assert(std::relation<P1, S1, S1>); 36*96dbdd75SChristopher Di Bella 37*96dbdd75SChristopher Di Bella struct P2 { 38*96dbdd75SChristopher Di Bella bool operator()(S1, S1) const; 39*96dbdd75SChristopher Di Bella bool operator()(S1, S2) const; 40*96dbdd75SChristopher Di Bella }; 41*96dbdd75SChristopher Di Bella static_assert(!std::relation<P2, S1, S2>); 42*96dbdd75SChristopher Di Bella 43*96dbdd75SChristopher Di Bella struct P3 { 44*96dbdd75SChristopher Di Bella bool operator()(S1, S1) const; 45*96dbdd75SChristopher Di Bella bool operator()(S1, S2) const; 46*96dbdd75SChristopher Di Bella bool operator()(S2, S1) const; 47*96dbdd75SChristopher Di Bella }; 48*96dbdd75SChristopher Di Bella static_assert(!std::relation<P3, S1, S2>); 49*96dbdd75SChristopher Di Bella 50*96dbdd75SChristopher Di Bella struct P4 { 51*96dbdd75SChristopher Di Bella bool operator()(S1, S1) const; 52*96dbdd75SChristopher Di Bella bool operator()(S1, S2) const; 53*96dbdd75SChristopher Di Bella bool operator()(S2, S1) const; 54*96dbdd75SChristopher Di Bella bool operator()(S2, S2) const; 55*96dbdd75SChristopher Di Bella }; 56*96dbdd75SChristopher Di Bella static_assert(std::relation<P4, S1, S2>); 57