Add Result to Transform

This commit is contained in:
sha512sum 2024-03-26 08:29:51 +00:00
parent 8fdb31dc6e
commit f43eae6080

View file

@ -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);
template <TupleLike Tuple>
inline constexpr auto Transform(Tuple&& container, auto&& f) {
template <TupleLike Tuple, typename R = Tuple>
inline constexpr auto Transform(Tuple&& container, auto&& f, TypeList<R> = {}) {
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>>());
};