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|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Callable concepts <a id="concepts.callable">[[concepts.callable]]</a>
|
| 2 |
+
|
| 3 |
+
### General <a id="concepts.callable.general">[[concepts.callable.general]]</a>
|
| 4 |
+
|
| 5 |
+
The concepts in subclause [[concepts.callable]] describe the
|
| 6 |
+
requirements on function objects [[function.objects]] and their
|
| 7 |
+
arguments.
|
| 8 |
+
|
| 9 |
+
### Concept <a id="concept.invocable">[[concept.invocable]]</a>
|
| 10 |
+
|
| 11 |
+
The `invocable` concept specifies a relationship between a callable type
|
| 12 |
+
[[func.def]] `F` and a set of argument types `Args...` which can be
|
| 13 |
+
evaluated by the library function `invoke` [[func.invoke]].
|
| 14 |
+
|
| 15 |
+
``` cpp
|
| 16 |
+
template<class F, class... Args>
|
| 17 |
+
concept invocable = requires(F&& f, Args&&... args) {
|
| 18 |
+
invoke(std::forward<F>(f), std::forward<Args>(args)...); // not required to be equality-preserving
|
| 19 |
+
};
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
[*Example 1*: A function that generates random numbers can model
|
| 23 |
+
`invocable`, since the `invoke` function call expression is not required
|
| 24 |
+
to be equality-preserving [[concepts.equality]]. — *end example*]
|
| 25 |
+
|
| 26 |
+
### Concept <a id="concept.regularinvocable">[[concept.regularinvocable]]</a>
|
| 27 |
+
|
| 28 |
+
``` cpp
|
| 29 |
+
template<class F, class... Args>
|
| 30 |
+
concept regular_invocable = invocable<F, Args...>;
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
The `invoke` function call expression shall be
|
| 34 |
+
equality-preserving [[concepts.equality]] and shall not modify the
|
| 35 |
+
function object or the arguments.
|
| 36 |
+
|
| 37 |
+
[*Note 1*: This requirement supersedes the annotation in the definition
|
| 38 |
+
of `invocable`. — *end note*]
|
| 39 |
+
|
| 40 |
+
[*Example 1*: A random number generator does not model
|
| 41 |
+
`regular_invocable`. — *end example*]
|
| 42 |
+
|
| 43 |
+
[*Note 2*: The distinction between `invocable` and `regular_invocable`
|
| 44 |
+
is purely semantic. — *end note*]
|
| 45 |
+
|
| 46 |
+
### Concept <a id="concept.predicate">[[concept.predicate]]</a>
|
| 47 |
+
|
| 48 |
+
``` cpp
|
| 49 |
+
template<class F, class... Args>
|
| 50 |
+
concept predicate =
|
| 51 |
+
regular_invocable<F, Args...> && boolean-testable<invoke_result_t<F, Args...>>;
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
### Concept <a id="concept.relation">[[concept.relation]]</a>
|
| 55 |
+
|
| 56 |
+
``` cpp
|
| 57 |
+
template<class R, class T, class U>
|
| 58 |
+
concept relation =
|
| 59 |
+
predicate<R, T, T> && predicate<R, U, U> &&
|
| 60 |
+
predicate<R, T, U> && predicate<R, U, T>;
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
### Concept <a id="concept.equiv">[[concept.equiv]]</a>
|
| 64 |
+
|
| 65 |
+
``` cpp
|
| 66 |
+
template<class R, class T, class U>
|
| 67 |
+
concept equivalence_relation = relation<R, T, U>;
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
A `relation` models `equivalence_relation` only if it imposes an
|
| 71 |
+
equivalence relation on its arguments.
|
| 72 |
+
|
| 73 |
+
### Concept <a id="concept.strictweakorder">[[concept.strictweakorder]]</a>
|
| 74 |
+
|
| 75 |
+
``` cpp
|
| 76 |
+
template<class R, class T, class U>
|
| 77 |
+
concept strict_weak_order = relation<R, T, U>;
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
A `relation` models `strict_weak_order` only if it imposes a *strict
|
| 81 |
+
weak ordering* on its arguments.
|
| 82 |
+
|
| 83 |
+
The term *strict* refers to the requirement of an irreflexive relation
|
| 84 |
+
(`!comp(x, x)` for all `x`), and the term *weak* to requirements that
|
| 85 |
+
are not as strong as those for a total ordering, but stronger than those
|
| 86 |
+
for a partial ordering. If we define `equiv(a, b)` as
|
| 87 |
+
`!comp(a, b) && !comp(b, a)`, then the requirements are that `comp` and
|
| 88 |
+
`equiv` both be transitive relations:
|
| 89 |
+
|
| 90 |
+
- `comp(a, b) && comp(b, c)` implies `comp(a, c)`
|
| 91 |
+
- `equiv(a, b) && equiv(b, c)` implies `equiv(a, c)`
|
| 92 |
+
|
| 93 |
+
[*Note 1*:
|
| 94 |
+
|
| 95 |
+
Under these conditions, it can be shown that
|
| 96 |
+
|
| 97 |
+
- `equiv` is an equivalence relation,
|
| 98 |
+
- `comp` induces a well-defined relation on the equivalence classes
|
| 99 |
+
determined by `equiv`, and
|
| 100 |
+
- the induced relation is a strict total ordering.
|
| 101 |
+
|
| 102 |
+
— *end note*]
|
| 103 |
+
|
| 104 |
+
<!-- Link reference definitions -->
|
| 105 |
+
[basic.compound]: basic.md#basic.compound
|
| 106 |
+
[basic.fundamental]: basic.md#basic.fundamental
|
| 107 |
+
[basic.lookup.argdep]: basic.md#basic.lookup.argdep
|
| 108 |
+
[basic.types]: basic.md#basic.types
|
| 109 |
+
[class.member.lookup]: class.md#class.member.lookup
|
| 110 |
+
[concept.assignable]: #concept.assignable
|
| 111 |
+
[concept.booleantestable]: #concept.booleantestable
|
| 112 |
+
[concept.common]: #concept.common
|
| 113 |
+
[concept.commonref]: #concept.commonref
|
| 114 |
+
[concept.constructible]: #concept.constructible
|
| 115 |
+
[concept.convertible]: #concept.convertible
|
| 116 |
+
[concept.copyconstructible]: #concept.copyconstructible
|
| 117 |
+
[concept.default.init]: #concept.default.init
|
| 118 |
+
[concept.derived]: #concept.derived
|
| 119 |
+
[concept.destructible]: #concept.destructible
|
| 120 |
+
[concept.equalitycomparable]: #concept.equalitycomparable
|
| 121 |
+
[concept.equiv]: #concept.equiv
|
| 122 |
+
[concept.invocable]: #concept.invocable
|
| 123 |
+
[concept.moveconstructible]: #concept.moveconstructible
|
| 124 |
+
[concept.predicate]: #concept.predicate
|
| 125 |
+
[concept.regularinvocable]: #concept.regularinvocable
|
| 126 |
+
[concept.relation]: #concept.relation
|
| 127 |
+
[concept.same]: #concept.same
|
| 128 |
+
[concept.strictweakorder]: #concept.strictweakorder
|
| 129 |
+
[concept.swappable]: #concept.swappable
|
| 130 |
+
[concept.totallyordered]: #concept.totallyordered
|
| 131 |
+
[concepts]: #concepts
|
| 132 |
+
[concepts.arithmetic]: #concepts.arithmetic
|
| 133 |
+
[concepts.callable]: #concepts.callable
|
| 134 |
+
[concepts.callable.general]: #concepts.callable.general
|
| 135 |
+
[concepts.compare]: #concepts.compare
|
| 136 |
+
[concepts.compare.general]: #concepts.compare.general
|
| 137 |
+
[concepts.equality]: #concepts.equality
|
| 138 |
+
[concepts.general]: #concepts.general
|
| 139 |
+
[concepts.lang]: #concepts.lang
|
| 140 |
+
[concepts.lang.general]: #concepts.lang.general
|
| 141 |
+
[concepts.object]: #concepts.object
|
| 142 |
+
[concepts.summary]: #concepts.summary
|
| 143 |
+
[concepts.syn]: #concepts.syn
|
| 144 |
+
[cpp17.destructible]: #cpp17.destructible
|
| 145 |
+
[customization.point.object]: library.md#customization.point.object
|
| 146 |
+
[declval]: utilities.md#declval
|
| 147 |
+
[defns.const.subexpr]: library.md#defns.const.subexpr
|
| 148 |
+
[expr.log.and]: expr.md#expr.log.and
|
| 149 |
+
[expr.log.or]: expr.md#expr.log.or
|
| 150 |
+
[expr.prim.id]: expr.md#expr.prim.id
|
| 151 |
+
[expr.unary.op]: expr.md#expr.unary.op
|
| 152 |
+
[forward]: utilities.md#forward
|
| 153 |
+
[func.def]: utilities.md#func.def
|
| 154 |
+
[func.invoke]: utilities.md#func.invoke
|
| 155 |
+
[function.objects]: utilities.md#function.objects
|
| 156 |
+
[lib.types.movedfrom]: library.md#lib.types.movedfrom
|
| 157 |
+
[meta.trans.other]: utilities.md#meta.trans.other
|
| 158 |
+
[meta.type.synop]: utilities.md#meta.type.synop
|
| 159 |
+
[namespace.memdef]: dcl.md#namespace.memdef
|
| 160 |
+
[over.best.ics]: over.md#over.best.ics
|
| 161 |
+
[structure.requirements]: library.md#structure.requirements
|
| 162 |
+
[temp.deduct.call]: temp.md#temp.deduct.call
|
| 163 |
+
[temp.deduct.type]: temp.md#temp.deduct.type
|
| 164 |
+
[template.bitset]: utilities.md#template.bitset
|
| 165 |
+
|
| 166 |
+
[^1]: The name `swap` is used here unqualified.
|