January 2018
Intermediate to advanced
374 pages
9h 53m
English
The parameter pack is identified by putting three dots in front of the type name, and three dots after the variadic argument expands the pack, with a comma in between:
Here's the syntactic explanation:
To put it into code, consider this expand_pack function:
template <typename ...Ts>
auto expand_pack(const Ts& ...values) {
auto tuple = std::tie(values...);
}
Let's call the preceding function like this:
expand_pack(42, std::string{"hi"});
In that case, the compiler will generate a function similar to this:
auto ...