How to use an overloaded function as an argument of function template?
Posted
by hpsmouse
on Stack Overflow
See other posts from Stack Overflow
or by hpsmouse
Published on 2010-06-14T06:19:59Z
Indexed on
2010/06/14
6:22 UTC
Read the original article
Hit count: 232
Hello,
I think everyone has experience working with a code like the following:
void fun(Type1&);
void fun(Type2&);
vector<Type1> vec;
for_each(vec.begin(), vec.end(), fun);
Of course that won't compile, because it's not clear which function to be passed. And what's your commonly-used solution to the problem?
© Stack Overflow or respective owner