tmp/tmpmjhtdqs4/{from.md → to.md}
RENAMED
|
@@ -1,15 +1,16 @@
|
|
| 1 |
#### Partial ordering of class template specializations <a id="temp.class.order">[[temp.class.order]]</a>
|
| 2 |
|
| 3 |
For two class template partial specializations, the first is *more
|
| 4 |
specialized* than the second if, given the following rewrite to two
|
| 5 |
function templates, the first function template is more specialized than
|
| 6 |
-
the second according to the ordering rules for function templates
|
| 7 |
-
[[temp.func.order]]
|
| 8 |
|
| 9 |
-
- Each of the two function templates has the same template parameters
|
| 10 |
-
|
|
|
|
| 11 |
- Each function template has a single function parameter whose type is a
|
| 12 |
class template specialization where the template arguments are the
|
| 13 |
corresponding template parameters from the function template for each
|
| 14 |
template argument in the *template-argument-list* of the
|
| 15 |
*simple-template-id* of the partial specialization.
|
|
@@ -39,5 +40,24 @@ function template *D* is more specialized than the function template
|
|
| 39 |
the partial specialization \#1 and the partial specialization \#4 is
|
| 40 |
more specialized than the partial specialization \#3.
|
| 41 |
|
| 42 |
— *end example*]
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
#### Partial ordering of class template specializations <a id="temp.class.order">[[temp.class.order]]</a>
|
| 2 |
|
| 3 |
For two class template partial specializations, the first is *more
|
| 4 |
specialized* than the second if, given the following rewrite to two
|
| 5 |
function templates, the first function template is more specialized than
|
| 6 |
+
the second according to the ordering rules for function templates
|
| 7 |
+
[[temp.func.order]]:
|
| 8 |
|
| 9 |
+
- Each of the two function templates has the same template parameters
|
| 10 |
+
and associated constraints [[temp.constr.decl]] as the corresponding
|
| 11 |
+
partial specialization.
|
| 12 |
- Each function template has a single function parameter whose type is a
|
| 13 |
class template specialization where the template arguments are the
|
| 14 |
corresponding template parameters from the function template for each
|
| 15 |
template argument in the *template-argument-list* of the
|
| 16 |
*simple-template-id* of the partial specialization.
|
|
|
|
| 40 |
the partial specialization \#1 and the partial specialization \#4 is
|
| 41 |
more specialized than the partial specialization \#3.
|
| 42 |
|
| 43 |
— *end example*]
|
| 44 |
|
| 45 |
+
[*Example 2*:
|
| 46 |
+
|
| 47 |
+
``` cpp
|
| 48 |
+
template<typename T> concept C = requires (T t) { t.f(); };
|
| 49 |
+
template<typename T> concept D = C<T> && requires (T t) { t.f(); };
|
| 50 |
+
|
| 51 |
+
template<typename T> class S { };
|
| 52 |
+
template<C T> class S<T> { }; // #1
|
| 53 |
+
template<D T> class S<T> { }; // #2
|
| 54 |
+
|
| 55 |
+
template<C T> void f(S<T>); // A
|
| 56 |
+
template<D T> void f(S<T>); // B
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
The partial specialization \#2 is more specialized than \#1 because `B`
|
| 60 |
+
is more specialized than `A`.
|
| 61 |
+
|
| 62 |
+
— *end example*]
|
| 63 |
+
|