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 equivalence_relation; 13*96dbdd75SChristopher Di Bella 14*96dbdd75SChristopher Di Bella #include <concepts> 15*96dbdd75SChristopher Di Bella 16*96dbdd75SChristopher Di Bella static_assert(std::equivalence_relation<bool(int, int), int, int>); 17*96dbdd75SChristopher Di Bella static_assert(std::equivalence_relation<bool(int, int), double, double>); 18*96dbdd75SChristopher Di Bella static_assert(std::equivalence_relation<bool(int, double), double, double>); 19*96dbdd75SChristopher Di Bella 20*96dbdd75SChristopher Di Bella static_assert(!std::equivalence_relation<bool (*)(), int, double>); 21*96dbdd75SChristopher Di Bella static_assert(!std::equivalence_relation<bool (*)(int), int, double>); 22*96dbdd75SChristopher Di Bella static_assert(!std::equivalence_relation<bool (*)(double), int, double>); 23*96dbdd75SChristopher Di Bella 24*96dbdd75SChristopher Di Bella static_assert( 25*96dbdd75SChristopher Di Bella !std::equivalence_relation<bool(double, double*), double, double*>); 26*96dbdd75SChristopher Di Bella static_assert(!std::equivalence_relation<bool(int&, int&), double&, double&>); 27*96dbdd75SChristopher Di Bella 28*96dbdd75SChristopher Di Bella struct S1 {}; 29*96dbdd75SChristopher Di Bella static_assert(std::relation<bool (S1::*)(S1*), S1*, S1*>); 30*96dbdd75SChristopher Di Bella static_assert(std::relation<bool (S1::*)(S1&), S1&, S1&>); 31*96dbdd75SChristopher Di Bella 32*96dbdd75SChristopher Di Bella struct S2 {}; 33*96dbdd75SChristopher Di Bella 34*96dbdd75SChristopher Di Bella struct P1 { 35*96dbdd75SChristopher Di Bella bool operator()(S1, S1) const; 36*96dbdd75SChristopher Di Bella }; 37*96dbdd75SChristopher Di Bella static_assert(std::equivalence_relation<P1, S1, S1>); 38*96dbdd75SChristopher Di Bella 39*96dbdd75SChristopher Di Bella struct P2 { 40*96dbdd75SChristopher Di Bella bool operator()(S1, S1) const; 41*96dbdd75SChristopher Di Bella bool operator()(S1, S2) const; 42*96dbdd75SChristopher Di Bella }; 43*96dbdd75SChristopher Di Bella static_assert(!std::equivalence_relation<P2, S1, S2>); 44*96dbdd75SChristopher Di Bella 45*96dbdd75SChristopher Di Bella struct P3 { 46*96dbdd75SChristopher Di Bella bool operator()(S1, S1) const; 47*96dbdd75SChristopher Di Bella bool operator()(S1, S2) const; 48*96dbdd75SChristopher Di Bella bool operator()(S2, S1) const; 49*96dbdd75SChristopher Di Bella }; 50*96dbdd75SChristopher Di Bella static_assert(!std::equivalence_relation<P3, S1, S2>); 51*96dbdd75SChristopher Di Bella 52*96dbdd75SChristopher Di Bella struct P4 { 53*96dbdd75SChristopher Di Bella bool operator()(S1, S1) const; 54*96dbdd75SChristopher Di Bella bool operator()(S1, S2) const; 55*96dbdd75SChristopher Di Bella bool operator()(S2, S1) const; 56*96dbdd75SChristopher Di Bella bool operator()(S2, S2) const; 57*96dbdd75SChristopher Di Bella }; 58*96dbdd75SChristopher Di Bella static_assert(std::equivalence_relation<P4, S1, S2>); 59