#include<set>
template<typename Return, typename T>
T ReceiveFuncPtr (Return (T::*Method)(const int&))
{
T obj;
(obj.*Method)(1);
return obj;
}
int main ()
{
ReceiveFuncPtr(&std::set<int>::insert); // ERROR
}
I2luY2x1ZGU8c2V0PgoKdGVtcGxhdGU8dHlwZW5hbWUgUmV0dXJuLCB0eXBlbmFtZSBUPgpUIFJlY2VpdmVGdW5jUHRyIChSZXR1cm4gKFQ6OipNZXRob2QpKGNvbnN0IGludCYpKQp7CiAgVCBvYmo7CiAgKG9iai4qTWV0aG9kKSgxKTsKICByZXR1cm4gb2JqOwp9CgppbnQgbWFpbiAoKQp7CiAgUmVjZWl2ZUZ1bmNQdHIoJnN0ZDo6c2V0PGludD46Omluc2VydCk7IC8vIEVSUk9SCn0K
prog.cpp: In function 'int main()':
prog.cpp:13:40: error: no matching function for call to 'ReceiveFuncPtr(<unresolved overloaded function type>)'
ReceiveFuncPtr(&std::set<int>::insert); // ERROR
^
prog.cpp:13:40: note: candidate is:
prog.cpp:4:3: note: template<class Return, class T> T ReceiveFuncPtr(Return (T::*)(const int&))
T ReceiveFuncPtr (Return (T::*Method)(const int&))
^
prog.cpp:4:3: note: template argument deduction/substitution failed:
prog.cpp:13:40: note: mismatched types 'const int&' and 'std::initializer_list<int>'
ReceiveFuncPtr(&std::set<int>::insert); // ERROR
^
prog.cpp:13:40: note: mismatched types 'const int&' and 'std::set<int>::const_iterator {aka std::_Rb_tree_const_iterator<int>}'
prog.cpp:13:40: note: mismatched types 'const int&' and 'std::set<int>::const_iterator {aka std::_Rb_tree_const_iterator<int>}'
prog.cpp:13:40: note: mismatched types 'const int&' and 'std::set<int>::value_type&& {aka int&&}'
prog.cpp:13:40: note: couldn't deduce template parameter 'Return'