Add Result to Transform
This commit is contained in:
parent
8fdb31dc6e
commit
f43eae6080
1 changed files with 3 additions and 3 deletions
|
@ -162,10 +162,10 @@ template <typename T>
|
||||||
concept TupleLike = kForceEnableTuple<std::remove_cvref_t<T>> || (requires{Get<0>(MakeTuple<T>(42));} && impl::IsSafeTuple<std::remove_cvref_t<T>>::value);
|
concept TupleLike = kForceEnableTuple<std::remove_cvref_t<T>> || (requires{Get<0>(MakeTuple<T>(42));} && impl::IsSafeTuple<std::remove_cvref_t<T>>::value);
|
||||||
|
|
||||||
|
|
||||||
template <TupleLike Tuple>
|
template <TupleLike Tuple, typename R = Tuple>
|
||||||
inline constexpr auto Transform(Tuple&& container, auto&& f) {
|
inline constexpr auto Transform(Tuple&& container, auto&& f, TypeList<R> = {}) {
|
||||||
return [&]<auto... Is>(std::index_sequence<Is...>){
|
return [&]<auto... Is>(std::index_sequence<Is...>){
|
||||||
return MakeTuple<Tuple>(f(Get<Is>(std::forward<Tuple>(container)))...);
|
return MakeTuple<R>(f(Get<Is>(std::forward<Tuple>(container)))...);
|
||||||
}(std::make_index_sequence<kTupleSize<Tuple>>());
|
}(std::make_index_sequence<kTupleSize<Tuple>>());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue