49 class RPP_EMPTY_BASES tuple_impl<std::index_sequence<Indices...>, Args...> :
private tuple_leaf<Indices, Args>...
52 tuple_impl() =
default;
54 template<
typename... TArgs>
56 tuple_impl(TArgs&&... args)
57 : tuple_leaf<Indices, Args>{std::forward<TArgs>(args)}...
61 template<
typename... TArgs, std::invocable<TArgs&&..., Args&...> Callable>
62 auto apply(Callable&& callable, TArgs&&... args)
64 return std::forward<Callable>(callable)(std::forward<TArgs>(args)...,
static_cast<tuple_leaf<Indices, Args>*
>(
this)->get()...);
67 template<
typename... TArgs, std::invocable<TArgs&&..., Args...> Callable>
68 auto apply(Callable&& callable, TArgs&&... args)
const
70 return std::forward<Callable>(callable)(std::forward<TArgs>(args)...,
static_cast<const tuple_leaf<Indices, Args>*
>(
this)->get()...);
74 requires (I <
sizeof...(Args))
75 const auto& get()
const
77 return static_cast<const tuple_leaf<I, type_at_index_t<I>
>*>(
this)->get();
81 requires (I <
sizeof...(Args))
84 return static_cast<tuple_leaf<I, type_at_index_t<I>
>*>(
this)->get();
88 template<
size_t I,
typename T>
89 constexpr static T type_at_index_impl(
const tuple_leaf<I, T>*);
93 constexpr static auto type_at_index() ->
decltype(type_at_index_impl<I>(std::declval<tuple_impl*>()));
96 requires (I <
sizeof...(Args))
97 using type_at_index_t =
decltype(type_at_index<I>());