相关疑难解决方法(0)

在C++中检查std :: vector <string>是否包含某个值

是否有内置函数告诉我我的矢量包含某个元素,例如

std::vector<string> v;
v.push_back("abc");
v.push_back("xyz");

if (v.contains("abc")) // I am looking for one such feature, is there any
                       // such function or i need to loop through whole vector?
Run Code Online (Sandbox Code Playgroud)

c++ vector std stdvector

67
推荐指数
4
解决办法
16万
查看次数

标签 统计

c++ ×1

std ×1

stdvector ×1

vector ×1