[temp.constr.order] (original) (raw)

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 Qif and only if, for every disjunctive clause in the disjunctive normal form134of P, subsumes every conjunctive clause in the conjunctive normal form135of Q, where

[Example 1:

The constraint subsumes A, but A does not subsume .

The constraint A subsumes , but does not subsume A.

Also note that every constraint subsumes itself.

— _end example_]

[Note 1:

The subsumption relation defines a partial ordering on constraints.

— _end note_]

A declaration D1 isat least as constrained as a declaration D2 if

A declaration D1 is more constrainedthan 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_]