std::set::find()函数能找到不在集合中的元素是怎么回事?

今天在做题的时候用到了set存元素,但是在调用find函数的时候能够找到不存在的元素。
单独写了个程序做了验证。
如下,分别插入1,2,5,10。
find 4
居然能够找到我肥肠的一头雾水。

img


#include <bits/stdc++.h>
using namespace std;

bool find(set<int> &a, int b) {
    if (*a.end() == b )
        return 1;
    set<int>::iterator ita = a.find(b) ;
    if (ita == a.end() )
        return 0;
    return 1;
}

int main() {
    set<int> a;
    a.insert(1);
    a.insert(2);
    a.insert(5);
    a.insert(10);
    set<int> ::iterator itb = a.find(4);
    cout << find(a, 4) << endl;
    cout << * itb << endl;


    return 0;
}

我会了。。
line5有问题。。。