您的位置:首页 > 其它

曾经不了解的set的知识

2016-04-26 21:59 176 查看
5.元素检索:find(),若找到,返回该键值迭代器的位置,否则,返回最后一个元素后面一个位置。

set<int> s;

set<int>::iterator it;

it=s.find(5); //查找键值为5的元素

if(it!=s.end()) //找到

cout<<*it<<endl;

else //未找到

cout<<"未找到";

C++ iterator 迭代器

Such as

Set<int>p;

set<int>iterator it;

则 。。。。

It=p.begin();

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: