Opened 8 years ago
Closed 8 years ago
#10771 closed Bugs (fixed)
remove_if is broken for slist
| Reported by: | Georgy | Owned by: | Ion Gaztañaga |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | container |
| Version: | Boost 1.57.0 | Severity: | Problem |
| Keywords: | Cc: | gkorolev@… |
Description
the following smaple produce a compilation error in msvs 2013 upd 3
#include <boost/container/slist.hpp> void foo() { boost::container::slist<int> bar; bar.remove_if([](const int& p) { return p == 0; }); }
error C2247: 'boost::intrusive::detail::key_nodeptr_comp<Pred,boost::intrusive::bhtraits<T,boost::intrusive::slist_node_traits<void *>,normal_link,boost::intrusive::default_tag,2>>::operator ()' not accessible because 'boost::intrusive::detail::key_nodeptr_comp<Pred,boost::intrusive::bhtraits<T,boost::intrusive::slist_node_traits<void *>,normal_link,boost::intrusive::default_tag,2>>' uses 'private' to inherit from 'boost::intrusive::detail::ebo_functor_holder<KeyValueCompare>'
Change History (3)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Yes. Witch functor works fine! But, boost 1.56 in first case work correctly. I found the following example works.
void foo1()
{
boost::container::slist<int> bar;
int va = 0;
bar.remove_if([&va](int p) { return p == va; });
}
It seems that something is wrong with empty closures.
comment:3 by , 8 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |

The code works fine in Clang, I suspect it's a Visual C++ error with lambdas, as an equivalent:
struct functor { bool operator()(const int& p) const{ return p == 0; } }; bar.remove_if(functor());works fine.