Answers for "check if element is present in vector in c+"

C++
19

if vector contains value c++

#include <algorithm>

if(std::find(v.begin(), v.end(), x) != v.end()) {
    /* v contains x */
} else {
    /* v does not contain x */
}
Posted by: Guest on January-17-2020

Code answers related to "check if element is present in vector in c+"

Browse Popular Code Answers by Language