#include <iostream>
template<typename... Args>
void print(Args const&... args)
{
    (std::cout << ... << args);
}
int main()
{
    std::cout << 1 << 2 << 3 << std::endl; // ok
    print(1, 2, 3);                        // ok
    print(1, 2, 3, std::endl);             // error! How to make it work?
}
See online demo
How to pass a function template as a template argument?
 
     
     
     
    