【问题标题】:Getting error C2064: term does not evaluate to a function taking 2 arguments出现错误 C2064:术语不计算为采用 2 个参数的函数
【发布时间】:2015-05-24 15:44:18
【问题描述】:

我收到了这个错误

错误 5 错误 C2064:术语不计算为采用 2 个参数的函数 C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xrefwrap 431 1

尝试这样做之后

typedef std::function<int(int, int)> op;


op someOperator = std::plus<int>();
op someOtherOperator = std::minus<int>();

所以我可以调用类似的函数

UpdateValues(int X, int Y, op One, op Two)
{
      //eventually doing something like
      One(X, someOtherInt);
      Two(Y, someOtherInt);
}

发生了什么事?

如果您需要,这里是我的文件的链接https://www.dropbox.com/s/vn2akcyb9f448e6/Checkers.rar?dl=0

【问题讨论】:

  • ideone 上编译和运行。尝试发布一个重现该问题的最小示例。
  • 所以在您发布的所有这些文件中,我们应该四处寻找无法编译的代码?

标签: c++ arguments evaluate


【解决方案1】:

非常感谢您 vsoftco 的回答,最后有三个不同的事情不断产生该错误:

我传递了一个 op 对象来代替 bool 参数 我传递了一个 op* 对象来代替 op 参数 我正在传递一个 op 对象来代替 op* 参数

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-02-19
    • 2011-09-27
    • 1970-01-01
    • 2018-10-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多