std::查找"错误无匹配函数"
std::find 'error no matching function'
说我有一个看起来像这样的A类A和一个B类:
Class A
{
private:
int a;
public :
bool operator==(const A &) const;
//other methods(...)
}
Class B
{
private:
std::vector<A> v;
public:
std::vector<A> &get_v() {return v;};
const std::vector<A>& get_v() const;
}
现在这样做时:
B b;
std::vector<A>::iterator it;
it=std::find (b.get_v().begin(), b.get_v().end(), an item of class A);
我得到的错误是
error: no matching function for call to 'find(std::vector<A>::iterator, std::vector<A>::iterator, A&)
我想念什么吗?谢谢
您忘记了#include <algorithm>
。
我认为您忘记了包括标题<algorithm>
您忘记了包含此标头文件
#include<vector>
。
相关文章:
- Rcpp并行无匹配函数,用于调用"转换"
- 为什么通过带有文字编号的引用调用会出现"无匹配函数"错误?
- 无匹配函数呼叫getline()
- 错误:呼叫构造器的匹配函数无匹配功能
- C 线程 - 无匹配函数供呼叫
- C 汇编错误:无匹配的构造函数以进行初始化
- 错误代码:无匹配函数供呼叫
- 为链接列表构建迭代器类(错误:无匹配的构造函数以初始化)
- 子类/超类的"无匹配函数调用"
- 无匹配函数呼叫
- 与(C )无匹配函数
- 将迭代器作为参数传递时无匹配的函数调用
- 无匹配函数呼叫
- 无匹配函数呼叫(类,C )
- C 11无匹配函数,可以呼叫'std :: vector
- 对矢量对:无匹配函数
- C 在较旧的JSON :: NLOHMANN库中使用push_back时无匹配函数
- std::查找"错误无匹配函数"
- C 错误无匹配函数
- 将STD向量作为参考:无匹配函数要呼叫