#include <iostream> using namespace std; template <typename T> void Foo(T&& a) { } int main() { int w=1; Foo<int*>(&w);//why no gg? int *w2; Foo<int*>(w2);//why gg? // your code goes here return 0; }
Standard input is empty
prog.cpp: In function 'int main()':
prog.cpp:9:14: error: no matching function for call to 'Foo(int*&)'
Foo<int*>(w2);//why gg?
^
prog.cpp:9:14: note: candidate is:
prog.cpp:4:6: note: template<class T> void Foo(T&&)
void Foo(T&& a) { }
^
prog.cpp:4:6: note: template argument deduction/substitution failed:
prog.cpp:9:14: note: cannot convert 'w2' (type 'int*') to type 'int*&&'
Foo<int*>(w2);//why gg?
^
Standard output is empty