6#ifndef SIMPLE_VECTOR_ALGORITHM_HPP
7#define SIMPLE_VECTOR_ALGORITHM_HPP
41 std::ranges::input_range TRange,
42 std::weakly_incrementable TOut,
43 std::copy_constructible TUnaryOp
46 requires std::indirectly_writable
49 std::indirect_result_t<TUnaryOp&, std::ranges::iterator_t<TRange>>
54 if (std::is_constant_evaluated())
56 std::ranges::transform(std::forward<TRange>(
range), result, std::ref(unaryOp));
62 std::execution::unseq,
63 std::ranges::cbegin(
range),
64 std::ranges::cend(
range),
90 std::ranges::input_range TRange1,
91 std::ranges::input_range TRange2,
92 std::weakly_incrementable TOut,
93 std::copy_constructible TBinaryOp
96 requires std::indirectly_writable
99 std::indirect_result_t<TBinaryOp&, std::ranges::iterator_t<TRange1>, std::ranges::iterator_t<TRange2>>
110 if (std::is_constant_evaluated())
112 std::ranges::transform(std::forward<TRange1>(range1), std::forward<TRange2>(range2), result, std::ref(binaryOp));
118 std::execution::unseq,
119 std::ranges::cbegin(range1),
120 std::ranges::cend(range1),
121 std::ranges::cbegin(range2),
148 std::ranges::input_range TRange,
149 std::move_constructible T,
150 std::copy_constructible TBinaryOp,
151 std::copy_constructible TUnaryOp
154 requires std::indirectly_unary_invocable
157 std::ranges::iterator_t<TRange>
159 binary_invokable_with_all_overloads_implicit_convertible_to
164 std::indirect_result_t<TUnaryOp&, std::ranges::iterator_t<TRange>>
176 if (std::is_constant_evaluated())
178 return std::transform_reduce
180 std::ranges::cbegin(
range),
181 std::ranges::cend(
range),
188 return std::transform_reduce
190 std::execution::unseq,
191 std::ranges::cbegin(
range),
192 std::ranges::cend(
range),
221 std::ranges::input_range TRange1,
222 std::ranges::input_range TRange2,
223 std::move_constructible T,
224 std::copy_constructible TBinaryOp1,
225 std::copy_constructible TBinaryOp2
228 requires std::invocable
231 std::iter_reference_t<std::ranges::iterator_t<TRange1>>,
232 std::iter_reference_t<std::ranges::iterator_t<TRange2>>
234 binary_invokable_with_all_overloads_implicit_convertible_to
239 std::indirect_result_t<TBinaryOp2&, std::ranges::iterator_t<TRange1>, std::ranges::iterator_t<TRange2>>
248 TBinaryOp1 binaryOp1,
252 if (std::is_constant_evaluated())
254 return std::transform_reduce
256 std::ranges::cbegin(range1),
257 std::ranges::cend(range1),
258 std::ranges::cbegin(range2),
265 return std::transform_reduce
267 std::execution::unseq,
268 std::ranges::cbegin(range1),
269 std::ranges::cend(range1),
270 std::ranges::cbegin(range2),
constexpr void transform_unseq(TRange &&range, TOut result, TUnaryOp unaryOp)
Applies the given unary operation to each element and writes into result.
Definition: Algorithm.hpp:52
constexpr T transform_reduce_unseq(TRange &&range, T init, TBinaryOp binaryOp, TUnaryOp unaryOp)
Applies the unaryOp to each elements from the range and reduces the results (possibly permuted and ag...
Definition: Algorithm.hpp:169
range(TRange &&) -> range< TRange >
Definition: Algorithm.hpp:19