Remove Elements from an Unordered Map Fulfilling a Predicate
问题 I want to remove elements (histogram bins) from an std::unordered_map (histogram) that fulfills a predictate (histogram bins having zero count) given as a lambda expression as follows std::remove_if(begin(m_map), end(m_map), [](const Bin & bin) { return bin.second == 0; }); but GCC-4.6.1 complains as follows /usr/include/c++/4.6/bits/stl_pair.h:156:2: error: assignment of read-only member ‘std::pair<const unsigned char, unsigned char>::first’ /usr/include/c++/4.6/bits/stl_pair.h: In member