Possible Duplicate:
How to find an item in a std::vector?
This is what I'm looking for:
#include <vector>
std::vector<int> foo() {
// to create and return a vector
return std::vector<int>();
}
void bar() {
if (foo().has(123)) { // it's not possible now, but how?
// do something
}
}
In other words, I'm looking for a short and simple syntax to validate the existence of an element in a vector. And I don't want to introduce another temporary variable for this vector. Thanks!