title: Iterator for a subset of a vector
body: <p>Is it possible to get a const iterator from a vector that can only iterate a certain range of the vector before being invalidated?</p>
  
  <p>For example if I have a vector of 10 elements, I want to return an iterator of elements 4 to 7.</p>
  
  <p>pseudo-code:</p>
  
  <pre><code>int main()
  {
      std::vector&lt;int&gt; vector = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
  
      auto iterator = GetRangedIterator(vector, 4, 7)
      for (const int&amp; num : iterator)
          print num;      // 4, 5, 6, 7
  }
  </code></pre>