c++函数传入迭代器引用引发报错

在这个函数里,传入的是迭代器引用会报错,但非引用就不会报错,为什么呢?
报错类型给的是没有与这些操作数匹配的"<<"

#include <iostream>
#include <vector>

using namespace std;

bool find(vector<int>::iterator& begin, vector<int>::iterator& end, int i) {
    while (begin != end) {
        if (*begin == i) {
            return true;
        }
        ++begin;
    }
    return false;
}

int main() {
    vector<int> a{ 5, 2, 234, 62, 1, 43, 2, 523, 53 };
    cout << find(a.begin(), a.end(), 165) << endl;
}

#include <iostream>
#include <vector>
using namespace std;
bool ssfind(vector<int>::iterator const &begin, vector<int>::iterator const &end, int i)
{
    vector<int>::iterator point = begin;
    while (point != end)
    {
        if (*point == i)
        {
            return true;
        }
        ++point;
    }
    return false;
}
int main()
{
    vector<int> a={5, 2, 234, 62, 1, 43, 2, 523, 53};
    cout << ssfind(a.begin(), a.end(), 43) << endl;
}

C++之error: cannot bind non-const lvalue reference of type ‘myString&’ to an rvalue of type ‘myString’ - C_hp - 博客园 先看代码(不想看代码可以直接看代码后的问题描述) //header.h #ifndef _HEADER_H #define _HEADER_H #define defaultSize 128 #inc https://www.cnblogs.com/area-h-p/p/11498481.html
有帮助望采纳