title: how to check a value exists in a c++ stl vector and apply a function to every element of the vector?
body: <p>I have two questions related to the <strong>vector</strong> class of the standard library in C++.</p>
  <ol>
  <li><p>How can I check whether a value (let's say of an integer) already exists in a vector?</p>
  <p>What I want in words is as follows: &quot;if the integer already exists in the vector, next one, else add it at the end of the vector.&quot;</p>
  </li>
  <li><p>How do I apply a function that holds arguments to every element in the vector? (It seems I can't do that with for_each)</p>
  <p>In words: &quot;for each z element in the vector apply MyAddFn(i,j)&quot;</p>
  </li>
  </ol>
  <p>... or maybe I'm not on the right track with the stl vector sequence container, and I should define my own iterator?</p>