I know how to select first parameter of variadic template:
template< class...Args> struct select_first; template< class A, class ...Args> struct
With C++17, the cleanest way is
template struct tag { using type = T; }; template struct select_last { // Use a fold-expression to fold the comma operator over the parameter pack. using type = typename decltype((tag{}, ...))::type; };
with O(1) instantiation depth.