#include <iostream>
using namespace std;
void f() {}
void f(int arg) {}
template<typename F, typename ...Args>
void execution(F func, Args&&... args)
{
func(std::forward<Args>(args)...);
}
int main()
{
execution(f, 1);
execution(f);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdm9pZCBmKCkge30Kdm9pZCBmKGludCBhcmcpIHt9Cgp0ZW1wbGF0ZTx0eXBlbmFtZSBGLCB0eXBlbmFtZSAuLi5BcmdzPgp2b2lkIGV4ZWN1dGlvbihGIGZ1bmMsIEFyZ3MmJi4uLiBhcmdzKQp7CglmdW5jKHN0ZDo6Zm9yd2FyZDxBcmdzPihhcmdzKS4uLik7Cn0KCmludCBtYWluKCkKewoJZXhlY3V0aW9uKGYsIDEpOwoJZXhlY3V0aW9uKGYpOwoKCXJldHVybiAwOwp9
prog.cpp: In function ‘int main()’:
prog.cpp:15:16: error: no matching function for call to ‘execution(<unresolved overloaded function type>, int)’
execution(f, 1);
^
prog.cpp:15:16: note: candidate is:
prog.cpp:8:6: note: template<class F, class ... Args> void execution(F, Args&& ...)
void execution(F func, Args&&... args)
^
prog.cpp:8:6: note: template argument deduction/substitution failed:
prog.cpp:15:16: note: couldn't deduce template parameter ‘F’
execution(f, 1);
^
prog.cpp:16:13: error: no matching function for call to ‘execution(<unresolved overloaded function type>)’
execution(f);
^
prog.cpp:16:13: note: candidate is:
prog.cpp:8:6: note: template<class F, class ... Args> void execution(F, Args&& ...)
void execution(F func, Args&&... args)
^
prog.cpp:8:6: note: template argument deduction/substitution failed:
prog.cpp:16:13: note: couldn't deduce template parameter ‘F’
execution(f);
^