|
856 | 856 | \item \tcode{std::move(as_const(p))(args...)}
|
857 | 857 | \end{itemize}
|
858 | 858 |
|
| 859 | +\rSec3[alg.func.obj]{Algorithm function objects} |
| 860 | + |
| 861 | +\pnum |
| 862 | +An \defn{algorithm function object} is |
| 863 | +a customization point object\iref{customization.point.object} |
| 864 | +that is specified as one or more overloaded function templates. |
| 865 | +The name of these function templates designates |
| 866 | +the corresponding algorithm function object. |
| 867 | + |
859 | 868 | \pnum
|
860 |
| -Each customization point object type constrains its return type to model a |
861 |
| -particular concept. |
| 869 | +For an algorithm function object \tcode{o}, |
| 870 | +let $S$ be the corresponding set of function templates. |
| 871 | +Then for any sequence of arguments $\tcode{args} \dotsc$, |
| 872 | +$\tcode{o(args} \dotsc \tcode{)}$ is expression-equivalent to |
| 873 | +$\tcode{s(args} \dotsc \tcode{)}$, |
| 874 | +where the result of name lookup for \tcode{s} is the overload set $S$. |
| 875 | +\begin{note} |
| 876 | +Algorithm function objects are not found by |
| 877 | +argument-dependent name lookup\iref{basic.lookup.argdep}. |
| 878 | +When found by unqualified name lookup\iref{basic.lookup.unqual} |
| 879 | +for the \grammarterm{postfix-expression} in a function call\iref{expr.call}, |
| 880 | +they inhibit argument-dependent name lookup. |
| 881 | +\begin{example} |
| 882 | +\begin{codeblock} |
| 883 | +void foo() { |
| 884 | + using namespace std::ranges; |
| 885 | + std::vector<int> vec{1,2,3}; |
| 886 | + find(begin(vec), end(vec), 2); // \#1 |
| 887 | +} |
| 888 | +\end{codeblock} |
| 889 | +The function call expression at \#1 invokes \tcode{std::ranges::find}, |
| 890 | +not \tcode{std::find}. |
| 891 | +\end{example} |
| 892 | +\end{note} |
862 | 893 |
|
863 | 894 | \rSec3[functions.within.classes]{Functions within classes}
|
864 | 895 |
|
|
0 commit comments