|
57 | 57 | \pnum
|
58 | 58 | In the following, $X_i$ and $X_j$ refer to evaluations of the \emph{same} expression
|
59 | 59 | or statement contained in the application of an element access function
|
60 |
| -corresponding to the i\textsuperscript{th} and j\textsuperscript{th} elements of the input sequence. |
| 60 | +corresponding to the $i^\text{th}$ and $j^\text{th}$ elements of the input sequence. |
61 | 61 | \begin{note}There might be several evaluations $X_k$, $Y_k$, etc. of a single
|
62 | 62 | expression or statement in application $k$, for example, if the expression or
|
63 | 63 | statement appears in a loop within the element access function.\end{note}
|
|
284 | 284 | Each of the function templates in this section return an \defn{induction object} of unspecified type having an \defn{induction value type} and encapsulating an initial value $i$ of that type and, optionally, a $stride$.
|
285 | 285 |
|
286 | 286 | \pnum
|
287 |
| -For each element in the input range, an algorithm over input sequence S computes an \defn{induction value} from an induction variable and ordinal position $p$ within S by the formula $i + p * stride$ if a stride was specified or $i + p$ otherwise. This induction value is passed to the element access function. |
| 287 | +For each element in the input range, an algorithm over input sequence $S$ computes an \defn{induction value} from an induction variable and ordinal position $p$ within $S$ by the formula $i + p * stride$ if a stride was specified or $i + p$ otherwise. This induction value is passed to the element access function. |
288 | 288 |
|
289 | 289 | \pnum
|
290 | 290 | An induction object may refer to a \defn{live-out} object to hold the final value of the induction sequence. When the algorithm using the induction object completes, the live-out object is assigned the value $i + n * stride$, where $n$ is the number of elements in the input range.
|
|
331 | 331 | \requires For the overloads with an \tcode{ExecutionPolicy}, \tcode{I} shall be an integral type or meet the requirements of a forward iterator type; otherwise, \tcode{I} shall be an integral type or meet the requirements of an input iterator type. \tcode{Size} shall be an integral type and \tcode{n} shall be non-negative. \tcode{S} shall have integral type and \tcode{stride} shall have non-zero value. \tcode{stride} shall be negative only if \tcode{I} has integral type or meets the requirements of a bidirectional iterator. The \tcode{rest} parameter pack shall have at least one element, comprising objects returned by invocations of \tcode{reduction} (\ref{parallel.alg.reductions}) and/or \tcode{induction} (\ref{parallel.alg.inductions}) function templates followed by exactly one invocable element-access function, $f$. For the overloads with an \tcode{ExecutionPolicy}, $f$ shall meet the requirements of \tcode{CopyConstructible}; otherwise, $f$ shall meet the requirements of \tcode{MoveConstructible}.
|
332 | 332 |
|
333 | 333 | \pnum
|
334 |
| -\effects Applies {\em f} to each element in the \defn{input sequence}, as described below, with additional arguments corresponding to the reductions and inductions in the \tcode{rest} parameter pack. The length of the input sequence is: |
| 334 | +\effects Applies $f$ to each element in the \defn{input sequence}, as described below, with additional arguments corresponding to the reductions and inductions in the \tcode{rest} parameter pack. The length of the input sequence is: |
335 | 335 |
|
336 | 336 | \begin{itemize}
|
337 | 337 | \item \tcode{n}, if specified,
|
|
345 | 345 |
|
346 | 346 | The first element in the input sequence is \tcode{start}. Each subsequent element is generated by adding \tcode{stride} to the previous element, if \tcode{stride} is specified, otherwise by incrementing the previous element.
|
347 | 347 | \begin{note}As described in the \Cpp Standard, \CppXref{algorithms.general}, arithmetic on non-random-access iterators is performed using advance and distance.\end{note}
|
348 |
| -\begin{note}The order of the elements of the input sequence is important for determining ordinal position of an application of {\em f}, even though the applications themselves may be unordered.\end{note} |
| 348 | +\begin{note}The order of the elements of the input sequence is important for determining ordinal position of an application of $f$, even though the applications themselves may be unordered.\end{note} |
349 | 349 |
|
350 |
| -The first argument to {\em f} is an element from the input sequence.\begin{note}If \tcode{I} is an iterator type, the iterators in the input sequence are not dereferenced before being passed to {\em f}.\end{note} For each member of the \tcode{rest} parameter pack excluding {\em f}, an additional argument is passed to each application of {\em f} as follows: |
| 350 | +The first argument to $f$ is an element from the input sequence.\begin{note}If \tcode{I} is an iterator type, the iterators in the input sequence are not dereferenced before being passed to $f$.\end{note} For each member of the \tcode{rest} parameter pack excluding $f$, an additional argument is passed to each application of $f$ as follows: |
351 | 351 |
|
352 | 352 | \begin{itemize}
|
353 | 353 | \item If the pack member is an object returned by a call to a reduction function listed in section [parallel.alg.reductions], then the additional argument is a reference to an accumulator of that reduction object.
|
354 | 354 |
|
355 |
| -\item If the pack member is an object returned by a call to \tcode{induction}, then the additional argument is the induction value for that induction object corresponding to the position of the application of {\em f} in the input sequence. |
| 355 | +\item If the pack member is an object returned by a call to \tcode{induction}, then the additional argument is the induction value for that induction object corresponding to the position of the application of $f$ in the input sequence. |
356 | 356 | \end{itemize}
|
357 | 357 |
|
358 | 358 | \pnum
|
359 |
| -\complexity Applies {\em f} exactly once for each element of the input sequence. |
| 359 | +\complexity Applies $f$ exactly once for each element of the input sequence. |
360 | 360 |
|
361 | 361 | \pnum
|
362 |
| -\remarks If {\em f} returns a result, the result is ignored. |
| 362 | +\remarks If $f$ returns a result, the result is ignored. |
363 | 363 |
|
364 | 364 | \end{itemdescr}
|
365 | 365 |
|
|
0 commit comments