[英]I get error unresolved overloaded function type in c++
Why would piece of code like this: 为什么这样的一段代码:
boost::bind (SomeFunc<float>, function arguments go here);
produce this error: 产生此错误:
no matching function for call to bind(<unresolved overloaded function type>
THanks 谢谢
You need to use a static_cast
to tell the compiler which overload to pick if it's ambiguous, eg: 您需要使用static_cast
告诉编译器哪个重载可以选择是否模棱两可,例如:
#include <boost/bind.hpp>
void foo(int) {}
void foo(double) {}
int main() {
boost::bind(static_cast<void(*)(int)>(&foo), _1);
}
Sometimes "unresolved overloaded function type" can mean "none of the overloads are viable" in which case you need to figure out why it can't use any and fix that. 有时, “无法解析的重载函数类型”可能意味着“没有重载是可行的”,在这种情况下,您需要弄清楚为什么它不能使用任何重载并进行修复。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.