File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -504,11 +504,18 @@ constexpr auto apply(Op &&op, T &&t) -> decltype(auto) {
504
504
return std::forward<T>(t).apply (std::forward<Op>(op));
505
505
}
506
506
507
- template <typename Op, tuplelike T> constexpr auto transform (Op &&op, T &&t) {
508
- return std::forward<T>(t).apply ([&]<typename ... Ts>(Ts &&...ts ) {
509
- return stdx::tuple<decltype (op (std::forward<Ts>(ts)))...>{
510
- op (std::forward<Ts>(ts))...};
511
- });
507
+ template <template <typename > typename ... Fs, typename Op, tuplelike T>
508
+ constexpr auto transform (Op &&op, T &&t) {
509
+ if constexpr (sizeof ...(Fs) == 0 ) {
510
+ return std::forward<T>(t).apply ([&]<typename ... Ts>(Ts &&...ts ) {
511
+ return stdx::tuple<decltype (op (std::forward<Ts>(ts)))...>{
512
+ op (std::forward<Ts>(ts))...};
513
+ });
514
+ } else {
515
+ return std::forward<T>(t).apply ([&]<typename ... Ts>(Ts &&...ts ) {
516
+ return stdx::make_indexed_tuple<Fs...>(op (std::forward<Ts>(ts))...);
517
+ });
518
+ }
512
519
}
513
520
514
521
template <typename Op, tuplelike T>
You can’t perform that action at this time.
0 commit comments