$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Gary Powell (powellg_at_[hidden])
Date: 2002-02-20 20:18:47
>>-------------------------------------------------------------
The specific problem that got me thinking about this is that I
couldn't find an easy way to make a predicate compare only
the ".second" member of a pair, as in a map lookup by value:
typedef std::map<int,float> map_t;
// find the map entry whose value is 3.14
void findpi(const map_t& themap)
{
std::find_if(themap.begin(), themap.end(),
member_equal(&map_t::value_type::second, 3.14));
}
<<----------------------------------------------------------------
The LL solution is of course:
std::find_if(themap.begin(), themap.end(),
( _1->*second == 3.14) );
-Gary-