#pragma once #include // IWYU pragma: keep #include #include #include template constexpr auto transform_array(const std::array & in, auto && transform) { std::array out {}; std::transform(in.begin(), in.end(), out.begin(), transform); return out; } namespace { template struct GetNth { decltype(auto) operator()(const auto & tup) const { if constexpr (sizeof...(N) == 1) { return std::get(tup); } else { return std::tie(std::get(tup)...); } } }; } template constexpr auto Nth = GetNth {}; constexpr auto GetFirst = Nth<0>; constexpr auto GetSecond = Nth<1>; constexpr auto GetSwapped = Nth<0, 1>;