Mar 25, 2019 at 3:12am
Suppose I have this function:
template<typename...T> void doSomething() {
}
and I call it :
doSomething<ClassA, ClassB, ClassC>();
How can I access these classes in the "doSomething()" function?
Mar 25, 2019 at 3:22am
The pack expansion T... is a comma-separated list of each type in the parameter pack T, or nothing if the pack is empty. That is, use the ellipsis.
To index parameter packs arbitrarily (i.e., to access the Ith element of the parameter pack), say std::tuple_element_t<I, std::tuple<Ts...>>.
What is doSomething()?
Last edited on Mar 25, 2019 at 3:30am
Mar 25, 2019 at 3:36am
"doSomething()" is just a method in which I want to access the Ts that are passed in.