Files
cppdraft_translate/cppdraft/alg/func/obj.md
2025-10-25 03:02:53 +03:00

51 lines
2.1 KiB
Markdown
Raw 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.

[alg.func.obj]
# 16 Library introduction [[library]](./#library)
## 16.3 Method of description [[description]](description#alg.func.obj)
### 16.3.3 Other conventions [[conventions]](conventions#alg.func.obj)
#### 16.3.3.4 Algorithm function objects [alg.func.obj]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L895)
An [*algorithm function object*](#def:algorithm_function_object "16.3.3.4Algorithm function objects[alg.func.obj]") is
a customization point object ([[customization.point.object]](customization.point.object "16.3.3.3.5Customization Point Object types"))
that is specified as one or more overloaded function templates[.](#1.sentence-1)
The name of these function templates designates
the corresponding algorithm function object[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L902)
For an algorithm function object o,
let S be the corresponding set of function templates[.](#2.sentence-1)
Then for any sequence of arguments args …,o(args …) is expression-equivalent tos(args …),
where the result of name lookup for s is the overload set S[.](#2.sentence-2)
[*Note [1](#note-1)*:
Algorithm function objects are not found by
argument-dependent name lookup ([[basic.lookup.argdep]](basic.lookup.argdep "6.5.4Argument-dependent name lookup"))[.](#2.sentence-3)
When found by unqualified name lookup ([[basic.lookup.unqual]](basic.lookup.unqual "6.5.3Unqualified name lookup"))
for 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")),
they inhibit argument-dependent name lookup[.](#2.sentence-4)
[*Example [1](#example-1)*: void foo() {using namespace std::ranges;
std::vector<int> vec{1,2,3};
find(begin(vec), end(vec), 2); // #1}
The function call expression at #1 invokes std::ranges::find,
not std::find[.](#2.sentence-5)
— *end example*]
— *end note*]