简体   繁体   English

我在C ++中得到未解决的错误重载函数类型

[英]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 谢谢

It could be that your function SomeFunc<float> is overloaded, in which case boost::bind cannot deal with this. 可能您的函数SomeFunc<float>已重载,在这种情况下boost::bind无法处理此问题。 You have to implement a manual solution, see here for more details: 您必须实施手动解决方案,有关更多详细信息,请参见此处

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.

相关问题 C ++错误:无效类型&#39; <unresolved overloaded function type> [int]&#39; - C++ error: invalid types '<unresolved overloaded function type>[int]' C ++ <unresolved overloaded function type> - c++ <unresolved overloaded function type> c ++ - <unresolved overloaded function type> - c++ - <unresolved overloaded function type> C++ 基础:未解析的重载函数类型 - C++ basics: unresolved overloaded function type c ++故障转换重载函数:<未解析的重载函数类型> - c++ Trouble casting overloaded function: <unresolved overloaded function type> C ++- <unresolved overloaded function type> 在函数模板调用中 - c++ - <unresolved overloaded function type> in function template calling C ++ <unresolved overloaded function type> 具有比较功能 - C++ <unresolved overloaded function type> with comparison function 错误:没有匹配的函数调用 &#39;sf::RenderWindow::draw(<unresolved overloaded function type> )&#39; SFML C++ - Error: no matching function for call to 'sf::RenderWindow::draw(<unresolved overloaded function type>)' SFML C++ C++ 多线程错误:没有匹配的 function 调用 'std::thread::thread(<unresolved overloaded function type></unresolved> - C++ Multithreading Error : no matching function for call to 'std::thread::thread(<unresolved overloaded function type> 错误:没有匹配的函数调用 &#39;sf::RenderWindow::draw(<unresolved overloaded function type> )&#39;| C++ 中的 SFML - Error: no matching function for call to 'sf::RenderWindow::draw(<unresolved overloaded function type>)'| SFML in C++
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM