2

I want to ask something about the template class. I know the basics like:

template<typename X, typename Y>
class tmp{
...
}

However, in the starter file of my programming assignment, I saw a new format as:

template<typename X, typename... Y>
class tmp<std::tuple<Y...>,X>{
...
}

Here, I know "..." is the parameter pack, but why there is another "< >" after the name of the class??

Zig Razor
  • 3,381
  • 2
  • 15
  • 35
Ayden Han
  • 21
  • 2

1 Answers1

1

This :

template<typename X, typename... Y>
class tmp<std::tuple<Y...>,X>{
...
}

is a notation to say:

We have a template with parameter X and a parameter pack Y. The class tmp is a template class that use the parameter pack Y in a tuple variable, and X as a simple template variable.

However this is a specialization of the template.

Zig Razor
  • 3,381
  • 2
  • 15
  • 35