Why do the following comparisons give different results? : <p>I'm trying to compare the following two quantities: an integer 'i' and the size of a vector v.</p>

<pre><code>#include &lt;vector&gt;
#include &lt;iostream&gt;

using namespace std;

int main()
{
    vector &lt;int&gt; v(26,0);
    int i = -1;

    cout &lt;&lt; i &lt;&lt; " " &lt;&lt; v.size() &lt;&lt; endl;
    if (i &lt; v.size()) cout &lt;&lt; "a1" &lt;&lt; endl;
    else cout &lt;&lt; "b1" &lt;&lt; endl;

    if (-1 &lt; 26) cout &lt;&lt; "a2" &lt;&lt; endl;
    else cout &lt;&lt; "b2" &lt;&lt; endl;
    return 0;
}
</code></pre>

<p>When I run the following code, the output that I get is:
-1 26
b1
a2</p>

<p>whereas I expect it to give:
-1 26
a1
a2</p>

<p>Why is this happening?</p>
