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

Why does this attempt to count parameter-pack elements with recursion behave differently from `sizeof...`?

template <typename... Ts> constexpr std::size_t count() { return sizeof...(Ts); } static_assert(count<int, double, char>() == 3);