title: vector.size() - 2 leads to infinite loop - C++
body: <p>I am trying to run a loop on vector but not on the last two elements. So for that I used the following implementation:</p>
  <pre><code>vector&lt;int&gt; x;
  for(int i=0;i&lt;x.size()-2;i++){
      cout&lt;&lt;&quot;looping over element&quot;&lt;&lt;endl;
  }
  </code></pre>
  <p>However, running the above code with no elements inserted into x leads to an infinite loop.
  Ideone <a href="http://%20https://ideone.com/r5Bh7p" rel="nofollow noreferrer">link</a>:</p>
  <p>Why do I get this behavior? If <code>x.size()==0</code> then <code>i&lt;-2</code> condition should not hold and the code should never enter the for loop</p>