求迭代器在vector,set,map中的位置

求迭代器在vector,set,map中的位置

利用distance()函数

vector<int> v;
auto i=lower_bound(v.begin(),v.end(),3);
cout<<distance(v.begin(),i);

猜你喜欢

转载自www.cnblogs.com/CADCADCAD/p/12728691.html