36 lines
1.4 KiB
Markdown
36 lines
1.4 KiB
Markdown
[concept.invocable]
|
||
|
||
# 18 Concepts library [[concepts]](./#concepts)
|
||
|
||
## 18.7 Callable concepts [[concepts.callable]](concepts.callable#concept.invocable)
|
||
|
||
### 18.7.2 Concept invocable [concept.invocable]
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/concepts.tex#L1215)
|
||
|
||
The [invocable](#concept:invocable "18.7.2 Concept invocable [concept.invocable]") concept specifies a relationship between a callable
|
||
type ([[func.def]](func.def "22.10.3 Definitions")) F and a set of argument types Args... which
|
||
can be evaluated by the library function invoke ([[func.invoke]](func.invoke "22.10.5 invoke functions"))[.](#1.sentence-1)
|
||
|
||
[ð](#concept:invocable)
|
||
|
||
`template<class F, class... Args>
|
||
concept [invocable](#concept:invocable "18.7.2 Concept invocable [concept.invocable]") = requires(F&& f, Args&&... args) {
|
||
invoke(std::forward<F>(f), std::forward<Args>(args)...); // not required to be equality-preserving
|
||
};
|
||
`
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/concepts.tex#L1228)
|
||
|
||
[*Example [1](#example-1)*:
|
||
|
||
A function that generates random numbers can model [invocable](#concept:invocable "18.7.2 Concept invocable [concept.invocable]"),
|
||
since the invoke function call expression is not required to be
|
||
equality-preserving ([[concepts.equality]](concepts.equality "18.2 Equality preservation"))[.](#2.sentence-1)
|
||
|
||
â *end example*]
|