memo

N4072: Fixed Size Parameter Packs

O(1)

#include <type_traits>

template <typename T>
struct identity { using type = T; };

template <std::size_t N, typename Tuple>
struct at;
template <std::size_t N, template <typename...> class Tuple, typename... Types>
struct at<N, Tuple<Types...>> {
    template <typename...[N] Args, typename Arg>
    static auto impl(Args..., Arg, ...) -> Arg;
    
    using type = typename decltype(impl(identity<Types>{}...))::type;
};