C++ 如何在boost vector中查找项目
我正在使用,我需要检查某个特定项目是否存在。Boost中是否有类似于STL查找算法的功能,例如C++ 如何在boost vector中查找项目,c++,boost,C++,Boost,我正在使用,我需要检查某个特定项目是否存在。Boost中是否有类似于STL查找算法的功能,例如std::find(vector.begin、vector.end、element)?下面的代码用作STL查找算法 包括标题 #include"boost\range\algorithm\find.hpp" int main() { boost::container::vector<int> my_intvector; my_intvector.push_back(1); my
std::find(vector.begin、vector.end、element)
?下面的代码用作STL查找算法
包括标题
#include"boost\range\algorithm\find.hpp"
int main()
{
boost::container::vector<int> my_intvector;
my_intvector.push_back(1);
my_intvector.push_back(2);
my_intvector.push_back(3);
my_intvector.push_back(4);
my_intvector.push_back(5);
boost::container::vector::iterator it;
it = boost::find(my_intvector,3);
}
#包括“boost\range\algorithm\find.hpp”
int main()
{
boost::container::vector my_intvector;
我的输入向量。向后推(1);
我的向量。推回(2);
我的向量。向后推(3);
我的向量。推回(4);
我的向量。向后推(5);
boost::container::vector::iterator;
it=boost::find(my_intvector,3);
}
std::find()
不能仅用于std::vector
sstd::find
()将处理满足迭代器要求的任何一对对象。可能是这样?相关:功能,或