14 #ifndef RANGES_V3_UTILITY_TUPLE_ALGORITHM_HPP
15 #define RANGES_V3_UTILITY_TUPLE_ALGORITHM_HPP
17 #include <initializer_list>
19 #include <type_traits>
26 #include <range/v3/detail/adl_get.hpp>
28 #include <range/v3/utility/static_const.hpp>
30 #include <range/v3/detail/prologue.hpp>
36 template<
typename Tup>
38 std::tuple_size<typename std::remove_reference<Tup>::type>::value>;
44 template<
typename Fun,
typename Tup,
std::size_t... Is>
48 return invoke(
static_cast<Fun &&
>(fun),
49 detail::adl_get<Is>(
static_cast<Tup &&
>(tup))...)
52 template<typename Fun, typename Tup>
53 constexpr
auto CPP_auto_fun(
operator())(Fun &&fun, Tup &&tup)(
const)
55 return tuple_apply_fn::impl(
static_cast<Fun &&
>(fun),
56 static_cast<Tup &&
>(tup),
57 tuple_indices_t<Tup>{})
70 template<
typename Tup,
typename Fun,
std::size_t... Is>
75 decltype(fun(detail::adl_get<Is>(
static_cast<Tup &&
>(tup))))...>{
76 fun(detail::adl_get<Is>(
static_cast<Tup &&
>(
79 template<typename Tup0, typename Tup1, typename Fun, std::size_t... Is>
80 static constexpr
auto CPP_auto_fun(impl2)(Tup0 &&tup0, Tup1 &&tup1, Fun &fun,
84 decltype(fun(detail::adl_get<Is>(
static_cast<Tup0 &&
>(tup0)),
85 detail::adl_get<Is>(
static_cast<Tup1 &&
>(tup1))))...>{
86 fun(detail::adl_get<Is>(
static_cast<Tup0 &&
>(tup0)),
87 detail::adl_get<Is>(
static_cast<Tup1 &&
>(tup1)))...}
90 template<typename Tup, typename Fun>
91 constexpr
auto CPP_auto_fun(
operator())(Tup &&tup, Fun fun)(
const)
93 return tuple_transform_fn::impl1(
94 static_cast<Tup &&
>(tup), fun,
95 tuple_indices_t<Tup>{})
97 template<
typename Tup0,
typename Tup1,
typename Fun>
98 constexpr
auto CPP_auto_fun(
operator())(Tup0 &&tup0, Tup1 &&tup1, Fun fun)(
const)
100 return tuple_transform_fn::impl2(
static_cast<Tup0 &&
>(tup0),
101 static_cast<Tup1 &&
>(tup1), fun,
102 tuple_indices_t<Tup0>{})
114 template<
typename Tup,
typename Val,
typename Fun>
115 static constexpr Val impl(Tup &&, Val val, Fun &)
122 static constexpr
auto CPP_auto_fun(impl)(Tup &&tup, Val val, Fun &fun)
125 static_cast<Tup &&
>(tup),
126 fun(std::move(val), detail::adl_get<I0>(
static_cast<Tup &&
>(tup))),
129 template<typename Tup, typename Val, typename Fun, std::size_t... Is>
130 static constexpr
auto CPP_auto_fun(impl2)(Tup &&tup, Val val, Fun &fun,
133 return tuple_foldl_fn::impl<Is...>(
static_cast<Tup &&
>(tup),
138 template<
typename Tup,
typename Val,
typename Fun>
139 constexpr
auto CPP_auto_fun(
operator())(Tup &&tup, Val val, Fun fun)(
const)
141 return tuple_foldl_fn::impl2(
static_cast<Tup &&
>(tup),
144 tuple_indices_t<Tup>{})
156 template<
typename Tup,
typename Fun,
std::size_t... Is>
159 (void)std::initializer_list<int>{
160 ((void)fun(detail::adl_get<Is>(
static_cast<Tup &&
>(tup))), 42)...};
164 template<
typename Tup,
typename Fun>
165 constexpr Fun operator()(Tup && tup, Fun fun)
const
167 return tuple_for_each_fn::impl(
168 static_cast<Tup &&
>(tup), fun, tuple_indices_t<Tup>{}),
180 template<
typename... Ts>
181 constexpr
auto CPP_auto_fun(
operator())(Ts &&... ts)(
const)
183 return std::make_tuple(
static_cast<Ts &&
>(ts)...)
194 #include <range/v3/detail/epilogue.hpp>
template(typename ActionFn, typename Rng)(concept(invocable_action_closure_)(ActionFn
\concept invocable_action_closure_
RANGES_INLINE_VARIABLE(detail::to_container_fn< detail::from_range< std::vector >>, to_vector) template< template< typename... > class ContT > auto to(RANGES_HIDDEN_DETAIL(detail
For initializing a container of the specified type with the elements of an Range.
Definition: conversion.hpp:399
_t< detail::make_indices_< N, index_sequence< 0 >, detail::strategy_(1, N)> > make_index_sequence
Generate index_sequence containing integer constants [0,1,2,...,N-1].
Definition: meta.hpp:473
std::integral_constant< std::size_t, N > size_t
An integral constant wrapper for std::size_t.
Definition: meta.hpp:163
typename Fn::template invoke< Args... > invoke
Evaluate the invocable Fn with the arguments Args.
Definition: meta.hpp:541
Definition: tuple_algorithm.hpp:178
Definition: tuple_algorithm.hpp:41
Definition: tuple_algorithm.hpp:112
Definition: tuple_algorithm.hpp:154