I think template functions can have default arguments parameters (not template parameters but runtime parameters). We can also initialize a class with an empty bracket initialization. But how does the compiler match the template ?
Why does this code compiles, how does the compiler make the deduction and what s Args in this function call example ?
What I have understand: The default bracket initialization call the empty constructor, implicitly created because there is no user-defined constructor or user-defined default constructor. That is, we can initialize any pack with {}.. So the deduction don't apply there because we can't choose one pack, every pack is candidate. Maybe the default variadic template argument is <> (no arguments).
template<typename...> class pack {};
template<class... Args>
inline auto make(pack<Args...> = {}) {
}
int main() { make(); }
(compiled with GCC) Note: I thought it wasn't, but default argument can be useful: 2 methods of calling the function: make < int, char, int >() (normal use) or make(myPack) for packing a variadic.