tmp/tmpjrjws8h1/{from.md → to.md}
RENAMED
|
@@ -1,27 +1,27 @@
|
|
| 1 |
### Boolean testability <a id="concept.booleantestable">[[concept.booleantestable]]</a>
|
| 2 |
|
| 3 |
The exposition-only `boolean-testable` concept specifies the
|
| 4 |
requirements on expressions that are convertible to `bool` and for which
|
| 5 |
-
the logical operators
|
| 6 |
-
[[expr.unary.op]]
|
|
|
|
| 7 |
|
| 8 |
``` cpp
|
| 9 |
template<class T>
|
| 10 |
concept boolean-testable-impl = convertible_to<T, bool>; // exposition only
|
| 11 |
```
|
| 12 |
|
| 13 |
Let `e` be an expression such that `decltype((e))` is `T`. `T` models
|
| 14 |
`boolean-testable-impl` only if:
|
| 15 |
|
| 16 |
-
- either `remove_cvref_t<T>` is not a class type, or
|
| 17 |
-
names `operator&&` and `operator||`
|
| 18 |
-
`remove_cvref_t<T>`
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
finds no disqualifying declaration (defined below).
|
| 23 |
|
| 24 |
A *disqualifying parameter* is a function parameter whose declared type
|
| 25 |
`P`
|
| 26 |
|
| 27 |
- is not dependent on a template parameter, and there exists an implicit
|
|
@@ -33,13 +33,13 @@ A *disqualifying parameter* is a function parameter whose declared type
|
|
| 33 |
arguments in a function call [[temp.deduct.call]] and `e` as the
|
| 34 |
argument succeeds.
|
| 35 |
|
| 36 |
A *key parameter* of a function template `D` is a function parameter of
|
| 37 |
type cv `X` or reference thereto, where `X` names a specialization of a
|
| 38 |
-
class template that
|
| 39 |
-
contains at least one template parameter that
|
| 40 |
-
argument deduction.
|
| 41 |
|
| 42 |
[*Example 1*:
|
| 43 |
|
| 44 |
In
|
| 45 |
|
|
@@ -64,12 +64,12 @@ A *disqualifying declaration* is
|
|
| 64 |
disqualifying parameter; or
|
| 65 |
- a function template declaration that contains at least one
|
| 66 |
disqualifying parameter, where
|
| 67 |
- at least one disqualifying parameter is a key parameter; or
|
| 68 |
- the declaration contains no key parameters; or
|
| 69 |
-
- the declaration declares a function template
|
| 70 |
-
|
| 71 |
|
| 72 |
[*Note 1*: The intention is to ensure that given two types `T1` and
|
| 73 |
`T2` that each model `boolean-testable-impl`, the `&&` and `||`
|
| 74 |
operators within the expressions `declval<T1>() && declval<T2>()` and
|
| 75 |
`declval<T1>() || declval<T2>()` resolve to the corresponding built-in
|
|
@@ -86,7 +86,7 @@ template<class T>
|
|
| 86 |
Let `e` be an expression such that `decltype((e))` is `T`. `T` models
|
| 87 |
`boolean-testable` only if `bool(e) == !bool(!e)`.
|
| 88 |
|
| 89 |
[*Example 2*: The types `bool`, `true_type` [[meta.type.synop]],
|
| 90 |
`int*`, and `bitset<N>::reference` [[template.bitset]] model
|
| 91 |
-
|
| 92 |
|
|
|
|
| 1 |
### Boolean testability <a id="concept.booleantestable">[[concept.booleantestable]]</a>
|
| 2 |
|
| 3 |
The exposition-only `boolean-testable` concept specifies the
|
| 4 |
requirements on expressions that are convertible to `bool` and for which
|
| 5 |
+
the logical operators
|
| 6 |
+
[[expr.log.and]], [[expr.log.or]], [[expr.unary.op]] have the
|
| 7 |
+
conventional semantics.
|
| 8 |
|
| 9 |
``` cpp
|
| 10 |
template<class T>
|
| 11 |
concept boolean-testable-impl = convertible_to<T, bool>; // exposition only
|
| 12 |
```
|
| 13 |
|
| 14 |
Let `e` be an expression such that `decltype((e))` is `T`. `T` models
|
| 15 |
`boolean-testable-impl` only if:
|
| 16 |
|
| 17 |
+
- either `remove_cvref_t<T>` is not a class type, or a search for the
|
| 18 |
+
names `operator&&` and `operator||` in the scope of
|
| 19 |
+
`remove_cvref_t<T>` finds nothing; and
|
| 20 |
+
- argument-dependent lookup [[basic.lookup.argdep]] for the names
|
| 21 |
+
`operator&&` and `operator||` with `T` as the only argument type finds
|
| 22 |
+
no disqualifying declaration (defined below).
|
|
|
|
| 23 |
|
| 24 |
A *disqualifying parameter* is a function parameter whose declared type
|
| 25 |
`P`
|
| 26 |
|
| 27 |
- is not dependent on a template parameter, and there exists an implicit
|
|
|
|
| 33 |
arguments in a function call [[temp.deduct.call]] and `e` as the
|
| 34 |
argument succeeds.
|
| 35 |
|
| 36 |
A *key parameter* of a function template `D` is a function parameter of
|
| 37 |
type cv `X` or reference thereto, where `X` names a specialization of a
|
| 38 |
+
class template that has the same innermost enclosing non-inline
|
| 39 |
+
namespace as `D`, and `X` contains at least one template parameter that
|
| 40 |
+
participates in template argument deduction.
|
| 41 |
|
| 42 |
[*Example 1*:
|
| 43 |
|
| 44 |
In
|
| 45 |
|
|
|
|
| 64 |
disqualifying parameter; or
|
| 65 |
- a function template declaration that contains at least one
|
| 66 |
disqualifying parameter, where
|
| 67 |
- at least one disqualifying parameter is a key parameter; or
|
| 68 |
- the declaration contains no key parameters; or
|
| 69 |
+
- the declaration declares a function template to which no name is
|
| 70 |
+
bound [[dcl.meaning]].
|
| 71 |
|
| 72 |
[*Note 1*: The intention is to ensure that given two types `T1` and
|
| 73 |
`T2` that each model `boolean-testable-impl`, the `&&` and `||`
|
| 74 |
operators within the expressions `declval<T1>() && declval<T2>()` and
|
| 75 |
`declval<T1>() || declval<T2>()` resolve to the corresponding built-in
|
|
|
|
| 86 |
Let `e` be an expression such that `decltype((e))` is `T`. `T` models
|
| 87 |
`boolean-testable` only if `bool(e) == !bool(!e)`.
|
| 88 |
|
| 89 |
[*Example 2*: The types `bool`, `true_type` [[meta.type.synop]],
|
| 90 |
`int*`, and `bitset<N>::reference` [[template.bitset]] model
|
| 91 |
+
`boolean-testable`. — *end example*]
|
| 92 |
|