absl::c_transform

c_transform overloads

Synopses

Declared in <absl/algorithm/container.h>

Container-based version of the <algorithm> std::transform() function to transform a container's elements using the unary operation, storing the result in an iterator pointing to the last transformed element in the output range.

template<
    typename InputSequence,
    typename OutputIterator,
    typename UnaryOp>
constexpr
/* implementation-defined */
c_transform(
    InputSequence const& input,
    OutputIterator&& output,
    UnaryOp&& unary_op);
» more...

Performs a transformation using a unary predicate. Stores the result in output. absl::c_transform(input, output, unary_op) is equivalent to `std::transform(std::begin(input), std::end(input), std::begin(output), unary_op)`.

template<
    typename InputSequence,
    typename OutputRange,
    typename UnaryOp>
constexpr
/* implementation-defined */
c_transform(
    InputSequence const& input,
    OutputRange&& output,
    UnaryOp&& unary_op);
» more...

Overload of c_transform() for performing a transformation using a binary predicate. Applies binary_op to the first N elements of c1 and c2, where N = min(size(c1), size(c2)).

template<
    typename InputSequence1,
    typename InputSequence2,
    typename OutputIterator,
    typename BinaryOp>
constexpr
/* implementation-defined */
c_transform(
    InputSequence1 const& input1,
    InputSequence2 const& input2,
    OutputIterator&& output,
    BinaryOp&& binary_op);
» more...

Performs a transformation using a binary predicate. Stores the result in output. Applies binary_op to the first N elements of input1 and input2, where N = min(size(input1), size(input2)).

template<
    typename InputSequence1,
    typename InputSequence2,
    typename OutputRange,
    typename BinaryOp>
constexpr
std::common_type_t</* implementation-defined */, /* implementation-defined */>
c_transform(
    InputSequence1 const& input1,
    InputSequence2 const& input2,
    OutputRange&& output,
    BinaryOp&& binary_op);
» more...

Return Value

  • An iterator to the end of the transformed range in the output.
  • This overload returns no value; the results are written into output.

Parameters

NameDescription
inputThe container whose elements to transform.
outputThe output iterator receiving the transformed elements.
unary_opThe unary operation applied to each element.
input1The first input container.
input2The second input container.
binary_opThe binary operation applied to element pairs.