[temp.constr.order]
13 Templates [temp]
13.5 Template constraints [temp.constr]
13.5.5 Partial ordering by constraints [temp.constr.order]
A constraint P subsumes a constraint Q if and only if, for every disjunctive clause in the disjunctive normal form105 of P, subsumes every conjunctive clause in the conjunctive normal form106 of Q, where
- a disjunctive clause subsumes a conjunctive clause if and only if there exists an atomic constraint in for which there exists an atomic constraint in such that subsumes ,
- an atomic constraint A subsumes another atomic constraint B if and only if A and B are identical using the rules described in [temp.constr.atomic], and
- a fold expanded constraint A subsumes another fold expanded constraint B if they are compatible for subsumption, have the same fold-operator, and the constraint of A subsumes that of B.
The associated constraints C of a declaration D are eligible for subsumption unless C contains a concept-dependent constraint.
A declaration D1 is at least as constrained as a declaration D2 if
- D1 and D2 are both constrained declarations and D1's associated constraints are eligible for subsumption and subsume those of D2; or
- D2 has no associated constraints.
A declaration D1 is more constrained than another declaration D2 when D1 is at least as constrained as D2, and D2 is not at least as constrained as D1.
[Example 2: template<typename T> concept C1 = requires(T t) { --t; }; template<typename T> concept C2 = C1<T> && requires(T t) { *t; }; template<C1 T> void f(T); template<C2 T> void f(T); template<typename T> void g(T); template<C1 T> void g(T); f(0); f((int*)0); g(true); g(0); — end example]
[Example 3: template<template<typename T> concept CT, typename T> struct S {}; template<typename T> concept A = true; template<template<typename T> concept X, typename T> int f(S<X, T>) requires A<T> { return 42; } template<template<typename T> concept X, typename T> int f(S<X, T>) requires X<T> { return 43; } f(S<A, int>{}); — end example]
A non-template function F1 is more partial-ordering-constrained than a non-template function F2 if
- they have the same non-object-parameter-type-lists ([dcl.fct]), and
- if they are member functions, both are direct members of the same class, and
- if both are non-static member functions, they have the same types for their object parameters, and
- the declaration of F1 is more constrained than the declaration of F2.