Boost C++ Libraries: Ticket #8712: [function] Comparison with nullptr differs from std::function<> https://svn.boost.org/trac10/ticket/8712 <p> Whether or not boost::function&lt;&gt; <em>should</em> support comparison with (C++11) nullptr is another issue, but at the moment it is inconsistent with std::function&lt;&gt;. </p> <p> E.g. </p> <pre class="wiki">boost::function&lt;void ()&gt; bf; bool c1 = (bf == nullptr); // currently false std::function&lt;void ()&gt; sf; bool c2 = (sf == nullptr); // true assert(c1 == c2); </pre><p> Tested with g++ 4.6.3 and Visual Studio 2012. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8712 Trac 1.4.3 anonymous Tue, 30 Jul 2013 11:55:40 GMT <link>https://svn.boost.org/trac10/ticket/8712#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8712#comment:1</guid> <description> <p> I add a major hit count for this to be fixed! </p> </description> <category>Ticket</category> </item> <item> <author>Ryan.Livingston@…</author> <pubDate>Fri, 27 Jan 2017 11:01:20 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8712#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8712#comment:2</guid> <description> <p> Just encountered this in our code base. We ran clang-tidy with modernize-use-nullptr which converted some code from: </p> <pre class="wiki">if (aBoostFunction == NULL) { ... } else { aBoostFunction(...); } </pre><p> to: </p> <pre class="wiki">if (aBoostFunction == nullptr) { ... } else { aBoostFunction(...); } </pre><p> This change caused the comparison to return false as shown above and the empty function was invoked. </p> </description> <category>Ticket</category> </item> </channel> </rss>