STL之multiset(可重集)

https://www.cnblogs.com/tvtaqa/p/7128584.html

  c++语言中,multiset是<set>库中一个非常有用的类型,它可以看成一个序列,插入一个数,删除一个数都能够在O(logn)的时间内完成,而且他能时刻保证序列中的数是有序的,而且序列中可以存在重复的数。

 1.查找元素x是否存在    ---存在返回x   否则返回ms.end()

multiset<string>::iterator it;
it=ms.find("123");
if(it!=ms.end())
{
    cout<<*it<<endl;
}
else
    cout<<"not found"<<endl;

 

posted @ 2019-08-16 20:46  saaas  阅读(193)  评论(0)    收藏  举报