函数找到(值)和结束()是用于调用存储各种类型(名单,集,向量,地图...)的元素“容器”的类的成员函数。有更多关于容器的信息here。
两个成员函数返回一个迭代(样的指针)的容器元素。你可以阅读迭代器here。
抽象地讲,发现(值)会给你一个容器,它等于值的元素的位置。 end()将返回一个迭代器指向容器的末尾(最后一个元素后面的位置)。
所以你的情况:
// from mSharedState get liveIPs (a container storing IPs)
// and find the element with value destinationIP
mSharedState->liveIPs->find(flowStats->destinationIP)
// check if the iterator returned by find(flowStats->destinationIP) is different
// then the end of the liveIPs contatiner
!= liveIPs->end()
所以,“//做一些事情”将如果容器liveIPs保存与价值destinationIP元素执行。因为find(value)和end()通常是容器的成员函数,所以我认为你显示的代码片段是STL一致容器的成员函数的定义的一部分(可能是一些用户定义的容器符合STL容器接口,提供find(value)和end()作为成员函数)。
阅读[文件](http://en.cppreference.com/w/cpp/container/map/find),你就会明白为什么。 – chris
我可以看到什么查找方法。你发的不是我要求的? – smttsp