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// UNSUPPORTED: c++03, c++11, c++14, c++17
10
11// template<class F, class... Args>
12// concept strict_weak_order;
13
14#include <concepts>
15
16static_assert(std::strict_weak_order<bool(int, int), int, int>);
17static_assert(std::strict_weak_order<bool(int, int), double, double>);
18static_assert(std::strict_weak_order<bool(int, double), double, double>);
19
20static_assert(!std::strict_weak_order<bool (*)(), int, double>);
21static_assert(!std::strict_weak_order<bool (*)(int), int, double>);
22static_assert(!std::strict_weak_order<bool (*)(double), int, double>);
23
24static_assert(!std::strict_weak_order<bool(double, double*), double, double*>);
25static_assert(!std::strict_weak_order<bool(int&, int&), double&, double&>);
26
27struct S1 {};
28static_assert(std::strict_weak_order<bool (S1::*)(S1*), S1*, S1*>);
29static_assert(std::strict_weak_order<bool (S1::*)(S1&), S1&, S1&>);
30
31struct S2 {};
32
33struct P1 {
34 bool operator()(S1, S1) const;
35};
36static_assert(std::strict_weak_order<P1, S1, S1>);
37
38struct P2 {
39 bool operator()(S1, S1) const;
40 bool operator()(S1, S2) const;
41};
42static_assert(!std::strict_weak_order<P2, S1, S2>);
43
44struct P3 {
45 bool operator()(S1, S1) const;
46 bool operator()(S1, S2) const;
47 bool operator()(S2, S1) const;
48};
49static_assert(!std::strict_weak_order<P3, S1, S2>);
50
51struct P4 {
52 bool operator()(S1, S1) const;
53 bool operator()(S1, S2) const;
54 bool operator()(S2, S1) const;
55 bool operator()(S2, S2) const;
56};
57static_assert(std::strict_weak_order<P4, S1, S2>);
58

source code of libcxx/test/std/concepts/concepts.callable/concept.strictweakorder/strict_weak_order.compile.pass.cpp