6#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_ALGORITHM_TRANSFORM_HPP_
7#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_ALGORITHM_TRANSFORM_HPP_
15#include "arene/base/stdlib_choice/cstddef.hpp"
16#include "arene/base/stdlib_choice/decay.hpp"
17#include "arene/base/stdlib_choice/declval.hpp"
18#include "arene/base/stdlib_choice/enable_if.hpp"
19#include "arene/base/stdlib_choice/forward.hpp"
20#include "arene/base/stdlib_choice/integer_sequence.hpp"
21#include "arene/base/stdlib_choice/make_tuple.hpp"
22#include "arene/base/stdlib_choice/move.hpp"
23#include "arene/base/stdlib_choice/pair.hpp"
24#include "arene/base/stdlib_choice/remove_cv.hpp"
25#include "arene/base/stdlib_choice/remove_reference.hpp"
26#include "arene/base/stdlib_choice/tuple.hpp"
27#include "arene/base/stdlib_choice/tuple_size.hpp"
28#include "arene/base/tuple/detail/get.hpp"
39namespace transform_detail {
50template <
class F,
typename TupleType,
std::size_t... Is>
63template <
template <
typename U, std::
size_t N>
class ToType,
typename F,
typename FromArrayType,
std::size_t... Is>
65 -> ToType<
std::decay_t<
decltype(func(*array.begin()))>,
sizeof...(Is)> {
66 return ToType<
std::decay_t<
decltype(func(*array.begin()))>,
sizeof...(Is)>{
95 typename UnaryOperation,
100 constexpr auto operator()(StartItr start, EndItr end, OutputItr out, UnaryOperation transform_op)
const noexcept(
104 while (start != end) {
107 *out++ = transform_op(*start++);
134 typename LhsStartItr,
138 typename BinaryOperation,
144 constexpr auto operator()(
145 LhsStartItr lhs_start,
149 BinaryOperation transform_op
156 while (lhs_start != lhs_end) {
159 *out++ = transform_op(*lhs_start++, *rhs_start++);
175 constexpr auto operator()(F&& func, PairType&& pair)
const {
189 constexpr auto operator()(F&& func, TupleType&& tuple)
const {
190 return transform_tuple_impl(
206 template <
typename T, std::
size_t N>
211 constexpr auto operator()(F&& func, ArrayLikeType<T, N>
const& array)
const {
223 template <
typename T, std::
size_t N>
228 constexpr auto operator()(F&& func, ArrayLikeType<T, N>&& array)
const {
#define ARENE_CPP14_INLINE_VARIABLE(type, name)
Emulates C++17's inline variable declarations for function objects.
Definition cpp14_inline.hpp:69
Implementation of a backport of std::forward_like.
Definition accumulate.hpp:37
constexpr auto forward_like
A backport of C++23's std::forward_like, which allows forwarding a type with the same reference and c...
constexpr bool is_nothrow_inequality_comparable_v
typename constraints_impl::constraints< EnableIfs... >::type constraints
Helper used to express template constraints in a consistent way using std::enable_if_t.
Definition constraints.hpp:51
remove_cv_t< remove_reference_t< T > > remove_cvref_t
Backport of std::remove_cvref_t.
Definition remove_cvref.hpp:35
Definition accumulate.hpp:36
constexpr auto make_tuple(Types &&... args) noexcept(noexcept(tuple< arene::base::unwrap_ref_decay_t< Types >... >(std::forward< Types >(args)...))) -> tuple< arene::base::unwrap_ref_decay_t< Types >... >
construct a tuple with types deduced from the provided arguments
Definition make_tuple.hpp:30
constexpr auto move(T &&value) noexcept -> remove_reference_t< T > &&
Cast a value to an rvalue.
Definition move.hpp:30
constexpr auto make_pair(T1 &&first, T2 &&second) noexcept(is_nothrow_constructible_v< pair_detail::deduced_pair_type_t< T1, T2 >, T1, T2 >) -> pair_detail::deduced_pair_type_t< T1, T2 >
Creates a std::pair object, deducing the target type from the types of arguments.
Definition pair.hpp:611
make_integer_sequence< size_t, Size > make_index_sequence
A helper alias template for make_integer_sequence<size_t, Size>
Definition integer_sequence.hpp:224
integer_sequence< size_t, Ints... > index_sequence
A helper alias template for integer_sequence<size_t, Ints>
Definition integer_sequence.hpp:218
::size_t size_t
A type suitable for holding the size of an object.
Definition cstddef.hpp:29
typename enable_if< Condition, Type >::type enable_if_t
Type alias to support constraining templates. Is an alias for the specified type if the Condition is ...
Definition enable_if.hpp:41
auto declval() noexcept -> T &&
A dummy function that is declared but not defined, with a user-specified return type,...
typename decay< Type >::type decay_t
A conversion equivalent to those performed when passing function arguments by value.
Definition decay.hpp:48
constexpr auto get(pair< T1, T2 > &values) noexcept -> tuple_element_t< I, pair< T1, T2 > > &
access an element of a pair
Definition pair.hpp:665
constexpr auto forward(remove_reference_t< T > &value) noexcept -> T &&
Cast a value to an rvalue if T is an rvalue or rvalue reference, otherwise forward an lvalue referenc...
Definition forward.hpp:24