Boost logo

Boost :

From: Giovanni Bajo (giovannibajo_at_[hidden])
Date: 2002-07-20 15:37:13


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). My proposal is to modify mem_fn so that it
handles automatically default conversion if needed, assuming it's possible
to code it.

Giovanni Bajo

Boost list run by bdawes at, gregod at, cpdaniel at, john at