Skip to content

Commit

Permalink
P3136R1 Retiring niebloids
Browse files Browse the repository at this point in the history
  • Loading branch information
jensmaurer committed Nov 27, 2024
1 parent d017ce4 commit 2c69870
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 50 deletions.
25 changes: 3 additions & 22 deletions source/algorithms.tex
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,9 @@
satisfying the assumptions on the algorithms.

\pnum
The entities defined in the \tcode{std::ranges} namespace in this Clause
are not found by argument-dependent name lookup\iref{basic.lookup.argdep}.
When found by unqualified\iref{basic.lookup.unqual} name lookup
for the \grammarterm{postfix-expression} in a function call\iref{expr.call},
they inhibit argument-dependent name lookup.

\begin{example}
\begin{codeblock}
void foo() {
using namespace std::ranges;
std::vector<int> vec{1,2,3};
find(begin(vec), end(vec), 2); // \#1
}
\end{codeblock}
The function call expression at \tcode{\#1} invokes \tcode{std::ranges::find},
not \tcode{std::find}, despite that
(a) the iterator type returned from \tcode{begin(vec)} and \tcode{end(vec)}
may be associated with namespace \tcode{std} and
(b) \tcode{std::find} is more specialized\iref{temp.func.order} than
\tcode{std::ranges::find} since the former requires
its first two parameters to have the same type.
\end{example}
The entities defined in the \tcode{std::ranges} namespace in this Clause and
specified as function templates are
algorithm function objects\iref{alg.func.obj}.

\pnum
For purposes of determining the existence of data races,
Expand Down
28 changes: 2 additions & 26 deletions source/iterators.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2932,32 +2932,8 @@
\end{example}

\pnum
The function templates defined in \ref{range.iter.ops} are not found by
argument-dependent name lookup\iref{basic.lookup.argdep}. When found by
unqualified\iref{basic.lookup.unqual} name lookup for the
\grammarterm{postfix-expression} in a function call\iref{expr.call}, they
inhibit argument-dependent name lookup.

\begin{example}
\begin{codeblock}
void foo() {
using namespace std::ranges;
std::vector<int> vec{1,2,3};
distance(begin(vec), end(vec)); // \#1
}
\end{codeblock}
The function call expression at \tcode{\#1} invokes \tcode{std::ranges::distance},
not \tcode{std::distance}, despite that
(a) the iterator type returned from \tcode{begin(vec)} and \tcode{end(vec)}
may be associated with namespace \tcode{std} and
(b) \tcode{std::distance} is more specialized\iref{temp.func.order} than
\tcode{std::ranges::distance} since the former requires its first two parameters
to have the same type.
\end{example}

\pnum
The number and order of deducible template parameters for the function templates defined
in \ref{range.iter.ops} is unspecified, except where explicitly stated otherwise.
The entities defined in \ref{range.iter.ops} are
algorithm function objects\iref{alg.func.obj}.

\rSec3[range.iter.op.advance]{\tcode{ranges::advance}}

Expand Down
35 changes: 33 additions & 2 deletions source/lib-intro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -856,9 +856,40 @@
\item \tcode{std::move(as_const(p))(args...)}
\end{itemize}

\rSec3[alg.func.obj]{Algorithm function objects}

\pnum
An \defn{algorithm function object} is
a customization point object\iref{customization.point.object}
that is specified as one or more overloaded function templates.
The name of these function templates designates
the corresponding algorithm function object.

\pnum
Each customization point object type constrains its return type to model a
particular concept.
For an algorithm function object \tcode{o},
let $S$ be the corresponding set of function templates.
Then for any sequence of arguments $\tcode{args} \dotsc$,
$\tcode{o(args} \dotsc \tcode{)}$ is expression-equivalent to
$\tcode{s(args} \dotsc \tcode{)}$,
where the result of name lookup for \tcode{s} is the overload set $S$.
\begin{note}
Algorithm function objects are not found by
argument-dependent name lookup\iref{basic.lookup.argdep}.
When found by unqualified name lookup\iref{basic.lookup.unqual}
for the \grammarterm{postfix-expression} in a function call\iref{expr.call},
they inhibit argument-dependent name lookup.
\begin{example}
\begin{codeblock}
void foo() {
using namespace std::ranges;
std::vector<int> vec{1,2,3};
find(begin(vec), end(vec), 2); // \#1
}
\end{codeblock}
The function call expression at \#1 invokes \tcode{std::ranges::find},
not \tcode{std::find}.
\end{example}
\end{note}

\rSec3[functions.within.classes]{Functions within classes}

Expand Down

0 comments on commit 2c69870

Please sign in to comment.