Skip to content

Commit 1f2a816

Browse files
jensmaurerzygoloid
authored andcommitted
LWG3058 Parallel adjacent_difference shouldn't require creating temporaries
1 parent 94a91b6 commit 1f2a816

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

source/numerics.tex

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9414,24 +9414,27 @@
94149414
\end{itemdecl}
94159415

94169416
\begin{itemdescr}
9417+
\pnum
9418+
Let \tcode{T} be the value type of \tcode{decltype(first)}.
9419+
For the overloads that do not take an argument \tcode{binary_op},
9420+
let \tcode{binary_op} be an lvalue
9421+
that denotes an object of type \tcode{minus<>}.
9422+
94179423
\pnum
94189424
\requires
94199425
\begin{itemize}
94209426
\item
9421-
For the overloads with no \tcode{ExecutionPolicy}, \tcode{InputIterator}'s value
9422-
type shall be \tcode{MoveAssignable} (\tref{moveassignable}) and shall
9427+
For the overloads with no \tcode{ExecutionPolicy},
9428+
\tcode{T} shall be \tcode{MoveAssignable} (\tref{moveassignable}) and shall
94239429
be constructible from the type of \tcode{*first}. \tcode{acc} (defined below)
94249430
shall be writable\iref{iterator.requirements.general} to the \tcode{result}
9425-
output iterator. The result of the expression \tcode{val - std::move(acc)} or
9431+
output iterator. The result of the expression
94269432
\tcode{binary_op(val, std::move(acc))} shall be writable to the \tcode{result} output iterator.
94279433

94289434
\item
9429-
For the overloads with an \tcode{ExecutionPolicy}, the value type of
9430-
\tcode{ForwardIterator1}
9431-
shall be \tcode{CopyConstructible} (\tref{copyconstructible}),
9432-
constructible from the expression \tcode{*first - *first} or
9433-
\tcode{binary_op(*first, *first)}, and assignable to the value type of
9434-
\tcode{ForwardIterator2}.
9435+
For the overloads with an \tcode{ExecutionPolicy},
9436+
the result of the expressions \tcode{binary_op(*first, *first)} and
9437+
\tcode{*first} shall be writable to \tcode{result}.
94359438

94369439
\item
94379440
For all overloads, in the ranges
@@ -9445,23 +9448,18 @@
94459448

94469449
\pnum
94479450
\effects For the overloads with no \tcode{ExecutionPolicy} and a non-empty range,
9448-
the function creates an accumulator \tcode{acc} whose type is \tcode{InputIterator}'s
9449-
value type, initializes it with \tcode{*first},
9451+
the function creates an accumulator \tcode{acc} of type \tcode{T},
9452+
initializes it with \tcode{*first},
94509453
and assigns the result to \tcode{*result}. For every iterator \tcode{i} in \range{first + 1}{last}
9451-
in order, creates an object \tcode{val} whose type is \tcode{InputIterator}'s value type, initializes it
9452-
with \tcode{*i}, computes \tcode{val - std::move(acc)} or \tcode{binary_op(val, std::move(acc))}, assigns the result
9454+
in order, creates an object \tcode{val} whose type is \tcode{T}, initializes it
9455+
with \tcode{*i}, computes \tcode{binary_op(val, std::move(acc))}, assigns the result
94539456
to \tcode{*(result + (i - first))}, and move assigns from \tcode{val} to \tcode{acc}.
94549457

94559458
\pnum
9456-
For the overloads with an \tcode{ExecutionPolicy} and a non-empty range, first the
9457-
function creates an object whose type is \tcode{ForwardIterator1}'s value type,
9458-
initializes it with \tcode{*first}, and assigns the result to \tcode{*result}.
9459-
Then for every \tcode{d}
9460-
in \crange{1}{last - first - 1}, creates an object \tcode{val} whose type is
9461-
\tcode{ForwardIterator1}'s value type, initializes it with
9462-
\tcode{*(first + d) - *(first + d - 1)} or
9463-
\tcode{binary_op(*(first + d), *(first + d - 1))}, and assigns the result to
9464-
\tcode{*(result + d)}.
9459+
For the overloads with an \tcode{ExecutionPolicy} and a non-empty range,
9460+
performs \tcode{*result = *first}.
9461+
Then, for every \tcode{d} in \tcode{[1, last - first - 1]},
9462+
performs \tcode{*(result + d) = binary_op(*(first + d), *(first + (d - 1)))}.
94659463

94669464
\pnum
94679465
\returns

0 commit comments

Comments
 (0)