32 lines
1.7 KiB
Markdown
32 lines
1.7 KiB
Markdown
[function.objects.general]
|
||
|
||
# 22 General utilities library [[utilities]](./#utilities)
|
||
|
||
## 22.10 Function objects [[function.objects]](function.objects#general)
|
||
|
||
### 22.10.1 General [function.objects.general]
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L11215)
|
||
|
||
A [*function object type*](#def:function_object,type "22.10.1 General [function.objects.general]") is an object
|
||
type ([[basic.types.general]](basic.types.general#term.object.type "6.9.1 General")) that can be the type of the[*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1 General [expr.post.general]") in a function call ([[expr.call]](expr.call "7.6.1.3 Function call"), [[over.match.call]](over.match.call "12.2.2.2 Function call syntax"))[.](#1.sentence-1)[193](#footnote-193 "Such a type is a function pointer or a class type which has a member operator() or a class type which has a conversion to a pointer to function.")
|
||
|
||
A [*function object*](#def:function_object "22.10.1 General [function.objects.general]") is an
|
||
object of a function object type[.](#1.sentence-2)
|
||
|
||
In the places where one would expect to pass a
|
||
pointer to a function to an algorithmic template ([[algorithms]](algorithms "26 Algorithms library")), the
|
||
interface is specified to accept a function object[.](#1.sentence-3)
|
||
|
||
This not only makes
|
||
algorithmic templates work with pointers to functions, but also enables them to
|
||
work with arbitrary function objects[.](#1.sentence-4)
|
||
|
||
[193)](#footnote-193)[193)](#footnoteref-193)
|
||
|
||
Such a type is a function
|
||
pointer or a class type which has a member operator() or a class type
|
||
which has a conversion to a pointer to function[.](#footnote-193.sentence-1)
|