title: Check if a given index exists in std::vector
body: <p>I need index access to my <code>std::vector</code>, and therefore I must check if an index is already available to first delete them, and then set a new value.</p>
  
  <p>Here's my setter function:</p>
  
  <pre><code>void SetVector(int position, int value) {
      std::vector&lt;int&gt;iterator it = testVector.begin();
      // need a check here
      testVector.insert(it-testVector.begin()+position, value);
  }
  </code></pre>
  
  <p>Or is this the wrong C++ collection for my needs? (should grow dynamically, so no <code>std:array</code> possible). Could use a <code>std::map</code> but maybe it's also possible with <code>std::vector</code>.</p>