title: C++11 / g++ : std:: qualifier required in lambda, although "using namespace std" is given
body: <p>I was trying to discover some of the goodies of the new C++11 standard (using g++ 4.6.2). Playing around with lambdas in a an "all_of" algorithm function, I encountered a strange problem with the std:: qualifier. </p>
  
  <p>I am "using" the std namespace as shown at the beginning of the code snippet. This makes the declaration of the pair variable in the for loop well-defined.</p>
  
  <p>However, I tried the same in the lambda argument used in the "all_of" algorithm. I came across several hard-to-understand error messages, before I realized that a full std:: qualified std::pair would work there, but only pair not.</p>
  
  <p>Am I missing an important point? The declaration of the lambda happens in this file, so the namespace should still be active here, right? Or does the required std:: qualifier depend on some STL code in a different file? Or is it likely to be a bug in g++?</p>
  
  <p>Best regards,
  Peter</p>
  
  <p>PS: the code compiles without warnings as pasted here, but removing the std:: in the all_of lambda, I get an error message.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;memory&gt;
  #include &lt;map&gt;
  #include &lt;string&gt;
  #include &lt;algorithm&gt;
  #include &lt;utility&gt;
  
  using namespace std;
  
  void duckburg() {
  
  const int threshold = 100;
  map &lt;string, int&gt; money;
  
  money["donald"] = 200;
  money["daisy"] = 400;
  money["scrooge"] = 2000000;
  
  // obviously, an "auto" type would work here nicely,
  // but this way my problem is illustrated more clearly:
  
  for (const pair &lt;string, int&gt; &amp;pair : money) {
      cout &lt;&lt; pair.first &lt;&lt; "\t" &lt;&lt; pair.second &lt;&lt; endl;
  }
  
  if (all_of(money.begin(), money.end(),
      [&amp;](std::pair&lt;string, int&gt; p) {
      return bool(p.second &gt; threshold);
  })) 
  {
      cout &lt;&lt; "yes, everyone is rich!";
  } else {
      cout &lt;&lt; "no, some are poor!";
  };
  }
  </code></pre>
  
  <p>Edit: Just noticed I received a downvote for this old question. No problem with that, but please elaborate on the reasons. It will help me improve future questions, and in the end the entire community will profit. Thanks!</p>