tmp/tmpjrqr5_vl/{from.md → to.md}
RENAMED
|
@@ -1,22 +1,24 @@
|
|
| 1 |
### Partial ordering by constraints <a id="temp.constr.order">[[temp.constr.order]]</a>
|
| 2 |
|
| 3 |
A constraint P *subsumes* a constraint Q if and only if, for every
|
| 4 |
-
disjunctive clause Pᵢ in the disjunctive normal form[^
|
| 5 |
|
| 6 |
of P, Pᵢ subsumes every conjunctive clause Qⱼ in the conjunctive normal
|
| 7 |
-
form[^
|
| 8 |
|
| 9 |
of Q, where
|
| 10 |
|
| 11 |
- a disjunctive clause Pᵢ subsumes a conjunctive clause Qⱼ if and only
|
| 12 |
if there exists an atomic constraint Pᵢₐ in Pᵢ for which there exists
|
| 13 |
an atomic constraint $Q_{jb}$ in Qⱼ such that Pᵢₐ subsumes $Q_{jb}$,
|
| 14 |
-
and
|
| 15 |
- an atomic constraint A subsumes another atomic constraint B if and
|
| 16 |
only if A and B are identical using the rules described in
|
| 17 |
-
[[temp.constr.atomic]]
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
[*Example 1*: Let A and B be atomic constraints [[temp.constr.atomic]].
|
| 20 |
The constraint A ∧ B subsumes A, but A does not subsume A ∧ B. The
|
| 21 |
constraint A subsumes A ∨ B, but A ∨ B does not subsume A. Also note
|
| 22 |
that every constraint subsumes itself. — *end example*]
|
|
@@ -34,14 +36,17 @@ partial ordering is used to determine
|
|
| 34 |
[[temp.spec.partial.order]], and
|
| 35 |
- the partial ordering of function templates [[temp.func.order]].
|
| 36 |
|
| 37 |
— *end note*]
|
| 38 |
|
|
|
|
|
|
|
|
|
|
| 39 |
A declaration `D1` is *at least as constrained* as a declaration `D2` if
|
| 40 |
|
| 41 |
- `D1` and `D2` are both constrained declarations and `D1`’s associated
|
| 42 |
-
constraints subsume those of `D2`; or
|
| 43 |
- `D2` has no associated constraints.
|
| 44 |
|
| 45 |
A declaration `D1` is *more constrained* than another declaration `D2`
|
| 46 |
when `D1` is at least as constrained as `D2`, and `D2` is not at least
|
| 47 |
as constrained as `D1`.
|
|
@@ -63,5 +68,34 @@ g(true); // selects #3 because C1<bool> is not satisfied
|
|
| 63 |
g(0); // selects #4
|
| 64 |
```
|
| 65 |
|
| 66 |
— *end example*]
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
### Partial ordering by constraints <a id="temp.constr.order">[[temp.constr.order]]</a>
|
| 2 |
|
| 3 |
A constraint P *subsumes* a constraint Q if and only if, for every
|
| 4 |
+
disjunctive clause Pᵢ in the disjunctive normal form[^3]
|
| 5 |
|
| 6 |
of P, Pᵢ subsumes every conjunctive clause Qⱼ in the conjunctive normal
|
| 7 |
+
form[^4]
|
| 8 |
|
| 9 |
of Q, where
|
| 10 |
|
| 11 |
- a disjunctive clause Pᵢ subsumes a conjunctive clause Qⱼ if and only
|
| 12 |
if there exists an atomic constraint Pᵢₐ in Pᵢ for which there exists
|
| 13 |
an atomic constraint $Q_{jb}$ in Qⱼ such that Pᵢₐ subsumes $Q_{jb}$,
|
|
|
|
| 14 |
- an atomic constraint A subsumes another atomic constraint B if and
|
| 15 |
only if A and B are identical using the rules described in
|
| 16 |
+
[[temp.constr.atomic]], and
|
| 17 |
+
- a fold expanded constraint A subsumes another fold expanded constraint
|
| 18 |
+
B if they are compatible for subsumption, have the same
|
| 19 |
+
*fold-operator*, and the constraint of A subsumes that of B.
|
| 20 |
|
| 21 |
[*Example 1*: Let A and B be atomic constraints [[temp.constr.atomic]].
|
| 22 |
The constraint A ∧ B subsumes A, but A does not subsume A ∧ B. The
|
| 23 |
constraint A subsumes A ∨ B, but A ∨ B does not subsume A. Also note
|
| 24 |
that every constraint subsumes itself. — *end example*]
|
|
|
|
| 36 |
[[temp.spec.partial.order]], and
|
| 37 |
- the partial ordering of function templates [[temp.func.order]].
|
| 38 |
|
| 39 |
— *end note*]
|
| 40 |
|
| 41 |
+
The associated constraints `C` of a declaration `D` are *eligible for
|
| 42 |
+
subsumption* unless `C` contains a concept-dependent constraint.
|
| 43 |
+
|
| 44 |
A declaration `D1` is *at least as constrained* as a declaration `D2` if
|
| 45 |
|
| 46 |
- `D1` and `D2` are both constrained declarations and `D1`’s associated
|
| 47 |
+
constraints are eligible for subsumption and subsume those of `D2`; or
|
| 48 |
- `D2` has no associated constraints.
|
| 49 |
|
| 50 |
A declaration `D1` is *more constrained* than another declaration `D2`
|
| 51 |
when `D1` is at least as constrained as `D2`, and `D2` is not at least
|
| 52 |
as constrained as `D1`.
|
|
|
|
| 68 |
g(0); // selects #4
|
| 69 |
```
|
| 70 |
|
| 71 |
— *end example*]
|
| 72 |
|
| 73 |
+
[*Example 3*:
|
| 74 |
+
|
| 75 |
+
``` cpp
|
| 76 |
+
template<template<typename T> concept CT, typename T>
|
| 77 |
+
struct S {};
|
| 78 |
+
template<typename T>
|
| 79 |
+
concept A = true;
|
| 80 |
+
|
| 81 |
+
template<template<typename T> concept X, typename T>
|
| 82 |
+
int f(S<X, T>) requires A<T> { return 42; } // #1
|
| 83 |
+
template<template<typename T> concept X, typename T>
|
| 84 |
+
int f(S<X, T>) requires X<T> { return 43; } // #2
|
| 85 |
+
|
| 86 |
+
f(S<A, int>{}); // ok, select #1 because #2 is not eligible for subsumption
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
— *end example*]
|
| 90 |
+
|
| 91 |
+
A non-template function `F1` is *more partial-ordering-constrained* than
|
| 92 |
+
a non-template function `F2` if
|
| 93 |
+
|
| 94 |
+
- they have the same non-object-parameter-type-lists [[dcl.fct]], and
|
| 95 |
+
- if they are member functions, both are direct members of the same
|
| 96 |
+
class, and
|
| 97 |
+
- if both are non-static member functions, they have the same types for
|
| 98 |
+
their object parameters, and
|
| 99 |
+
- the declaration of `F1` is more constrained than the declaration of
|
| 100 |
+
`F2`.
|
| 101 |
+
|