@@ -451,5 +451,37 @@ than an element in the range being searched.
451451
452452The elements of ``[start, end) `` must be partitioned with respect to the comparator used.
453453
454+ .. code :: cpp
455+
456+ template <typename Policy, typename InputIt, typename OutputIt, typename UnaryOp,
457+ typename UnaryPredicate>
458+ OutputIt
459+ transform_if(Policy&& policy, InputIt start, InputIt end, OutputIt result, UnaryOp op,
460+ UnaryPredicate pred); // (1)
461+
462+ template <typename Policy, typename InputIt1, typename InputIt2, typename OutputIt,
463+ typename BinaryOp, typename BinaryPredicate>
464+ OutputIt
465+ transform_if(Policy&& policy, InputIt1 start1, InputIt1 end1, InputIt2 start2, OutputIt result,
466+ BinaryOp op, BinaryPredicate pred); // (2)
467+
468+ ``oneapi::dpl::transform_if `` applies a given function to the elements of the input sequence(s) that
469+ satisfy a given predicate, and stores the result to the output. Depending on the arguments, the algorithm:
470+
471+ 1. Evaluates the unary predicate ``pred `` for each position ``i `` of the sequence
472+ ``[start, end) `` and if ``pred(start[i]) == true ``, it performs the unary operation
473+ ``op(start[i]) `` and stores the result into ``result[i] ``. If
474+ ``pred(start[i]) == false ``, the data element ``result[i] `` is not modified from its
475+ initial value. The return value is an iterator targeting past the last considered element of
476+ the output sequence, that is, ``result + (end - start) ``.
477+
478+ 2. Evaluates the binary predicate ``pred `` for each position ``i `` of the sequence
479+ ``[start1, end1) `` and if ``pred(start1[i], start2[i]) == true ``, it performs the
480+ binary operation ``op(start1[i], start2[i]) `` and stores the result into ``result[i] ``.
481+ If ``pred(start1[i], start2[i]) == false ``, the data element ``result[i] `` is not
482+ modified from its initial value. The return value is an iterator targeting past the last
483+ considered element of the output sequence, that is, ``result + (end1 - start1) ``.
484+
485+
454486.. _`C++ Standard` : https://isocpp.org/std/the-standard
455487.. _`SYCL` : https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html
0 commit comments