Files
2025-10-25 03:02:53 +03:00

36 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[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.2Concept invocable[concept.invocable]") concept specifies a relationship between a callable
type ([[func.def]](func.def "22.10.3Definitions")) F and a set of argument types Args... which
can be evaluated by the library function invoke ([[func.invoke]](func.invoke "22.10.5invoke functions"))[.](#1.sentence-1)
[🔗](#concept:invocable)
`template<class F, class... Args>
concept [invocable](#concept:invocable "18.7.2Concept 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.2Concept invocable[concept.invocable]"),
since the invoke function call expression is not required to be
equality-preserving ([[concepts.equality]](concepts.equality "18.2Equality preservation"))[.](#2.sentence-1)
— *end example*]