| 562 | // and leave non-tuple untouched. |
| 563 | template <class T> |
| 564 | CUTE_HOST_DEVICE constexpr |
| 565 | auto |
| 566 | flatten(T const& t) |
| 567 | { |
| 568 | if constexpr (is_tuple<T>::value) { |
| 569 | if constexpr (is_flat<T>::value) { // Shortcut for perf |
| 570 | return t; |
| 571 | } else { |
| 572 | return filter_tuple(t, [](auto const& a) { return flatten_to_tuple(a); }); |
| 573 | } |
| 574 | } else { |
| 575 | return t; |
| 576 | } |
| 577 | |
| 578 | CUTE_GCC_UNREACHABLE; |
| 579 | } |
| 580 | |
| 581 | namespace detail { |
| 582 |
no test coverage detected