map, lambda, remove_if
问题 So, i've problem with std::map, lambda and stl algorithm(remove_if). Actually, same code with std::list or std::vector works well. My test example : #include <map> #include <iostream> #include <algorithm> struct Foo { Foo() : _id(0) {} Foo(int id) : _id(id) { } int _id; }; typedef std::map<int, Foo> FooMap; int main() { FooMap m; for (int i = 0; i < 10; ++i) m[i + 100] = Foo(i); int removeId = 6; // <<< Error here >>> std::remove_if(m.begin(), m.end(), [=](const FooMap::value_type & item) {