Boost C++ Libraries: Ticket #10771: remove_if is broken for slist https://svn.boost.org/trac10/ticket/10771 <p> the following smaple produce a compilation error in msvs 2013 upd 3 </p> <div class="wiki-code"><div class="code"><pre><span class="cp">#include</span> <span class="cpf">&lt;boost/container/slist.hpp&gt;</span><span class="cp"></span> <span class="kt">void</span> <span class="nf">foo</span><span class="p">()</span> <span class="p">{</span> <span class="n">boost</span><span class="o">::</span><span class="n">container</span><span class="o">::</span><span class="n">slist</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="n">bar</span><span class="p">;</span> <span class="n">bar</span><span class="p">.</span><span class="n">remove_if</span><span class="p">([](</span><span class="k">const</span> <span class="kt">int</span><span class="o">&amp;</span> <span class="n">p</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="n">p</span> <span class="o">==</span> <span class="mi">0</span><span class="p">;</span> <span class="p">});</span> <span class="p">}</span> </pre></div></div><p> error C2247: 'boost::intrusive::detail::key_nodeptr_comp&lt;Pred,boost::intrusive::bhtraits&lt;T,boost::intrusive::slist_node_traits&lt;void *&gt;,normal_link,boost::intrusive::default_tag,2&gt;&gt;::operator ()' not accessible because 'boost::intrusive::detail::key_nodeptr_comp&lt;Pred,boost::intrusive::bhtraits&lt;T,boost::intrusive::slist_node_traits&lt;void *&gt;,normal_link,boost::intrusive::default_tag,2&gt;&gt;' uses 'private' to inherit from 'boost::intrusive::detail::ebo_functor_holder&lt;<a class="missing wiki">KeyValueCompare</a>&gt;' </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10771 Trac 1.4.3 Ion Gaztañaga Sat, 08 Nov 2014 23:05:46 GMT <link>https://svn.boost.org/trac10/ticket/10771#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10771#comment:1</guid> <description> <p> The code works fine in Clang, I suspect it's a Visual C++ error with lambdas, as an equivalent: </p> <pre class="wiki"> struct functor { bool operator()(const int&amp; p) const{ return p == 0; } }; bar.remove_if(functor()); </pre><p> works fine. </p> </description> <category>Ticket</category> </item> <item> <author>Georgy <gkorolev@…></author> <pubDate>Tue, 11 Nov 2014 08:34:54 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10771#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10771#comment:2</guid> <description> <p> Yes. Witch functor works fine! But, boost 1.56 in first case work correctly. I found the following example works. </p> <pre class="wiki">void foo1() { boost::container::slist&lt;int&gt; bar; int va = 0; bar.remove_if([&amp;va](int p) { return p == va; }); } </pre><p> It seems that something is wrong with empty closures. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Wed, 17 Dec 2014 14:50:24 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10771#comment:3 https://svn.boost.org/trac10/ticket/10771#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> I've changed to public inheritance in classes deriving from ebo_function_holder as a workaround to this MSVC limitation: </p> <p> [develop 12ee566] Workaround for bugs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/10771" title="#10771: Bugs: remove_if is broken for slist (closed: fixed)">#10771</a> and <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6720" title="#6720: Bugs: intrusive::unordered_set::clear_and_dispose does not compile on VC11 ... (closed: fixed)">#6720</a>. </p> Ticket