
25 Jun
2003
25 Jun
'03
11:19 a.m.
Markus Werle wrote:
Jaakko Jarvi wrote:
std::for_each(M.begin(), M.end(), std::cout << l::bind(select2nd(), l::_1) << " ");
Well, that's too complicated ;-) _binding_ to a function or functor is the approach I wanted to avoid.
I have to repeat my usual advice here, use the correct algorithm (even if it's not standard). template<class It, class F> void for_each_pair(It first, It last, F f) { for(; first != last; ++first) f(first->first, first->second); } for_each_pair(m.begin(), m.end(), std::cout << _2 << " ");