title: C++11 placeholders with boost
body: <p>This code ...</p>
  
  <pre><code>int main()
  {
      using namespace std::placeholders;
      ClassA a;
      ClassB b, b2;
      a.SigA.connect( std::bind(&amp;ClassB::PrintFoo, &amp;b) );
      a.SigB.connect( std::bind(&amp;ClassB::PrintInt, b,  _1));
      a.SigB.connect( std::bind(&amp;ClassB::PrintInt, &amp;b2, _1));
  
      a.SigA();
      a.SigB(4);
  }
  </code></pre>
  
  <p>Gives the compilation error, "error: reference to '_1' is ambiguous"</p>
  
  <p>It can be fixed by fully qualifying the placeholders ...</p>
  
  <pre><code>int main()
  {
      // using namespace std::placeholders;
      ClassA a;
      ClassB b, b2;
      a.SigA.connect( std::bind(&amp;ClassB::PrintFoo, &amp;b) );
      a.SigB.connect( std::bind(&amp;ClassB::PrintInt, b,  std::placeholders::_1));
      a.SigB.connect( std::bind(&amp;ClassB::PrintInt, &amp;b2, std::placeholders::_1));
  
      a.SigA();
      a.SigB(4);
  }
  </code></pre>
  
  <p>...but why doesn't the first code snippet work?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Just to prevent any ambiguity, I am compiling with Clang and Boost 1.52 with <code>--stdlib=libc++ -std=c++0x</code> and the entire code block is this ...</p>
  
  <pre><code>#include &lt;boost/signals2.hpp&gt;
  #include &lt;iostream&gt;
  
  struct ClassA
  {
      boost::signals2::signal&lt;void ()&gt;    SigA;
      boost::signals2::signal&lt;void (int)&gt; SigB;
  };
  
  struct ClassB
  {
      void PrintFoo()      { std::cout &lt;&lt; "Foo" &lt;&lt; std::endl; }
      void PrintInt(int i) { std::cout &lt;&lt; "Bar: " &lt;&lt; i &lt;&lt; std::endl; }
  };
  
  int main()
  {
      // using namespace std::placeholders;
      ClassA a;
      ClassB b, b2;
      a.SigA.connect( std::bind(&amp;ClassB::PrintFoo, &amp;b) );
      a.SigB.connect( std::bind(&amp;ClassB::PrintInt, b,  std::placeholders::_1));
      a.SigB.connect( std::bind(&amp;ClassB::PrintInt, &amp;b2, std::placeholders::_1));
  
      a.SigA();
      a.SigB(4);
  }
  </code></pre>