I have an overloaded function which I want to pass along wrapped in a std::function. GCC4.6 does not find a "matching function". While I did find some questions here the answers are not as clear as I would like them. Could someone tell me why the following code can not deduct the correct overload and how to (elegantly) work around it?
int test(const std::string&) {
return 0;
}
int test(const std::string*) {
return 0;
}
int main() {
std::function<int(const std::string&)> func = test;
return func();
}
See Question&Answers more detail:os