c++ - 解密未找到函数重载错误消息

标签 c++ linux icc

我有以下代码:-

class A : public B {
  public:
    _container (B* b) { 
      container_ = b;
    }
  private:
    B* container_;
};

void foo(const A& a, const B& b) {
  A new_a (a);
  new_a._container(&b);
}

如果我尝试使用 icpc12 编译它,我会得到:-

error: no instance of overloaded function "A::_container" matches the argument list
            argument types are: (const B *)
            object type is: A
      new_a._container (&b);

现在,我明白错误的第一行意味着被调用的函数和可用的函数定义之间存在某种类型不匹配,我正在尝试使用错误的其他两行缩小问题范围信息。

第二行和第三行是什么意思?

最佳答案

该函数将一个非常量指针作为参数,而您传递的是一个常量指针。

关于c++ - 解密未找到函数重载错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11130139/

相关文章:

linux - sed 在替换某些正则表达式时行为不端

linux - 我可以等待特定的子进程在 perl 中终止吗

c++ - 为什么为openmp并行处理不适用于矢量化色彩空间转换?

c++ - 英特尔 C++ 编译器 (19.0) 现在是否仅使用 Clang 前端(即已放弃 EDG)?

c++ - 二维数组的输出元素

c++ - 包含 "flint.h"或 "flint/flint.h"是更好的做法

linux - 在 bash 中用星号解析文件

c++ - 带线程的错误结果处理 vector <int>

C++使变量类型取决于用户输入

python-3.x - cython可以用icc编译吗?