You can use std::find as follows:
if (std::find(v.begin(), v.end(), “abc”) != v.end())
{
// Element in vector.
}
To be able to use std::find: include
If your container only contains unique values, consider using std::set instead. It allows querying of set membership with logarithmic complexity.
std::set
s.insert(“abc”);
s.insert(“xyz”);
if (s.find(“abc”) != s.end()) { …
If your vector is kept sorted, use std::binary_search, it offers logarithmic complexity as well.
If all else fails, fall back to std::find, which is a simple linear search.