C++ STL算法中的find()报错不匹配

C++find报错

img


auto p=find(first,last,to_be_place);

当有这段代码时,就会出现报错


In template: no matching function for call to '__iterator_category' error occurred here in instantiation of function template specialization 'std::__find_if>>' requested here in instantiation of function template specialization 'std::find>' requested here candidate template ignored: substitution failure [with _Iter = Text_iterator]: no type named 'iterator_category' in 'std::iterator_traits'

调用模版失败了

__iterator_category看看这个函数是什么样的。

  • 给你找了一篇非常好的博客,你可以看看是否有帮助,链接:C++ STL find()函数