title: Stopping an iterator before the end
body: <p>I have an iterator p and a vertex curvePoints:</p>
  
  <pre><code>for (p = curvePoints.begin(); p != curvePoints.end(); p++) {
    p-&gt;x = (1 - u) * p-&gt;x + u * (p+1)-&gt;x;
    p-&gt;y = (1 - u) * p-&gt;y + u * (p+1)-&gt;y;
  }
  </code></pre>
  
  <p>Right now the loops use the value of the next indexed object; how can I guarantee that that next value exists. In other words, how can I make the loop condition something like <code>(p+1) != curvePoints.end()</code> or <code>p != curvePoints.end() - 1</code>.</p>