#include #include namespace detail { struct any { template any(T &&) {} }; template struct first { typedef T type; }; template struct select_impl { template static U &&select(typename first::type..., U &&u, Vs &&...) { return static_cast(u); } }; template static auto select(const std::index_sequence&, Ts&&... ts) { return select_impl::select(static_cast(ts)...); } } template auto nth(Ts &&...ts) { return detail::select(std::make_index_sequence(), static_cast(ts)...); } int main() { auto x = ::nth<7>(0,"1",'2',3,"4",'5',6,"7"); std::cerr << x << std::endl; }