Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumC++variadic templatesSingle-choice MCQ

Given this recursive variadic 'index of type' helper, what does `index_of<char, int, char, double>::value` evaluate to?

template <typename T, typename... Ts> struct index_of; template <typename T, typename... Ts> struct index_of<T, T, Ts...> : std::integral_constant<int, 0> {}; template <typename T, typename U, typename... Ts> struct index_of<T, U, Ts...> : std::integral_constant<int, 1 + index_of<T, Ts...>::value> {};