Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-06-25 06:19:42


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 << " ");


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net