Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-07-20 15:42:38


From: "Giovanni Bajo" <giovannibajo_at_[hidden]>
> Hello,
>
> I'd be very tempted to write code like this:
>
> map<int, string> whatever;
> void DoSomething(int a);
>
> for_each(whatever.begin(), whatever.end(),
> bind(DoSomething, bind(&pair<int,string>::first, _1)));
>
> But it doesn't work. I suppose it's related to the fact that the type of
_1
> is map<int,string>::iterator, which is default convertible to
> pair<int,string> but it's not of the same type (or at least, it's not
> required to be, I reckon).

The type of _1 is map<int, string>::value_type, i.e. pair<int const,
string>.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk