This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

4379
cppdraft/function/objects.md Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,31 @@
[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.1General[function.objects.general]") is an object
type ([[basic.types.general]](basic.types.general#term.object.type "6.9.1General")) that can be the type of the[*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1General[expr.post.general]") in a function call ([[expr.call]](expr.call "7.6.1.3Function call"), [[over.match.call]](over.match.call "12.2.2.2Function 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.1General[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 "26Algorithms 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)