Isn't C++ operator== supposed to be left associative?
<p>Why does this C++ code print what it prints?</p>

<pre><code>#include &lt;vector&gt;
#include &lt;stdio.h&gt;

int p(const char *x) {
   printf("%s\n", x);
   return 0;
}

int main()
{
   if (p("LEFT") == p("RIGHT")) ;

   std::vector&lt;int&gt; v1;
   v1.push_back(1);
   std::vector&lt;int&gt;::iterator it = v1.erase(v1.begin());

   if (it == v1.end())
      printf("OK\n");
   else
      printf("FAIL\n");

   std::vector&lt;int&gt; v2;
   v2.push_back(1);
   if (v2.erase(v2.begin()) == v2.end())
      printf("OK\n");
   else
      printf("FAIL\n");

   return 0;
}
</code></pre>

<p>I'm confused about the OK/FAIL part. This is in contradiction with the LEFT/RIGHT part. What's happening here?</p>

<p>The output for me is:</p>

<pre><code>LEFT
RIGHT
OK
FAIL
</code></pre>
