- #include <iostream>
- #include <vector>
- #include <algorithm>
- using namespace std;
- int main()
- {
- vector<int> v;
- v.push_back(10);
- v.push_back(23);
- v.push_back(35);
- if(find(v.begin(), v.end(), 23) == v.end())
- {
- cout << "no1" << endl;
- }
- if(find(v.begin(), v.end(), 12) == v.end())
- {
- cout << "no2" << endl;
- }
- return 0;
- }
- 结果是:no2
STL Vector没有find()成员函数,只能用泛型find()
最新推荐文章于 2023-12-21 10:00:11 发布