Boost C++ Libraries: Ticket #11902: bind placeholder _1 is not defined https://svn.boost.org/trac10/ticket/11902 <p> bind placeholder _1 is not defined in version 1.60.0 . </p> <p> Example </p> <pre class="wiki">#include &lt;boost/bind/bind.hpp&gt; int f(int a, int b) { return a + b; } int main(void) { int x = 1; int a = boost::bind(f, 5, _1)(x); return 0; } </pre><p> Compiler output: </p> <pre class="wiki">bind_error.cpp: In function ‘int main()’: bind_error.cpp:11:29: error: ‘_1’ was not declared in this scope int a = boost::bind(f, 5, _1)(x); ^ bind_error.cpp:11:29: note: suggested alternative: In file included from /home/projekte/libwinforwiss/boost/boost_1_60_0/boost/bind/bind.hpp:2247:0, from bind_error.cpp:1: /home/projekte/libwinforwiss/boost/boost_1_60_0/boost/bind/placeholders.hpp:46:38: note: ‘boost::placeholders::_1’ BOOST_STATIC_CONSTEXPR boost::arg&lt;1&gt; _1; </pre><p> Replacing _1 with boost::placeholders::_1 works for 1.60.0 , but not for 1.59.0. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11902 Trac 1.4.3 Raffi Enficiaud Wed, 13 Jan 2016 12:52:27 GMT <link>https://svn.boost.org/trac10/ticket/11902#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11902#comment:1</guid> <description> <p> I have the same problem, but only on Visual. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Thu, 21 Jan 2016 22:42:45 GMT</pubDate> <title>component changed; owner set https://svn.boost.org/trac10/ticket/11902#comment:2 https://svn.boost.org/trac10/ticket/11902#comment:2 <ul> <li><strong>owner</strong> set to <span class="trac-author">Peter Dimov</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">bind</span> </li> </ul> Ticket Peter Dimov Sat, 23 Jan 2016 19:14:45 GMT <link>https://svn.boost.org/trac10/ticket/11902#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11902#comment:3</guid> <description> <p> This is by design; from now on, <code></code><code>#include &lt;boost/bind/bind.hpp&gt;</code><code></code> defines <code></code><code>_1</code><code></code> in namespace <code></code><code>boost::placeholders</code><code></code> without importing it into the global namespace, to avoid conflicts. For backward compatibility, <code></code><code>#include &lt;boost/bind.hpp&gt;</code><code></code> includes <code></code><code>boost/bind/bind.hpp</code><code></code> and does <code></code><code>using namespace boost::placeholders;</code><code></code>. </p> <p> So, to make the code compile, either include <code></code><code>boost/bind.hpp</code><code></code> instead, or add <code></code><code>using namespace boost::placeholders;</code><code></code>. </p> </description> <category>Ticket</category> </item> </channel> </rss>