How can I check for existence of element in std::vector, in one sentence?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/571394/how-to-find-an-item-in-a-stdvector">How to find an item in a std::vector?</a>  </p>
</blockquote>



<p>This is what I'm looking for:</p>

<pre><code>#include &lt;vector&gt;
std::vector&lt;int&gt; foo() {
  // to create and return a vector
  return std::vector&lt;int&gt;();
}
void bar() {
  if (foo().has(123)) { // it's not possible now, but how?
    // do something
  }
}
</code></pre>

<p>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!</p>
