All I want to do is to check whether an element exists in the vector or not, so I can deal with each case.
if ( item_present ) do_this(); else do_that(
In C++11 you can use any_of. For example if it is a vector v; then:
any_of
vector v;
if (any_of(v.begin(), v.end(), bind(equal_to(), _1, item))) do_this(); else do_that();
Alternatively, use a lambda:
if (any_of(v.begin(), v.end(), [&](const std::string& elem) { return elem == item; })) do_this(); else do_that();