printAll2
has no type (only printAll2<T>
does), so you can't pass it around without either specifying a template argument or casting a function pointer (that deduces that the template argument). While a lambda does have a type, since by itself it's not templated, only its operator()
is templated.