how to specify a pointer to an overloaded function?
Posted
by davka
on Stack Overflow
See other posts from Stack Overflow
or by davka
Published on 2010-05-31T08:55:21Z
Indexed on
2010/05/31
9:03 UTC
Read the original article
Hit count: 151
I want to pass an overloaded function to the std::for_each()
algorithm. e.g.:
void f(char c);
void f(int i);
std::string s("example");
std::for_each(s.begin(), s.end(), f);
I'd expect the compiler to resolve f()
by the iterator type. Apparently, it (gcc 4.1.2) doesn't do it. So, how can I specify which f()
I want?
thanks a lot
© Stack Overflow or respective owner