Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-03-02 16:20:51


yinglcs2_at_[hidden] wrote:
> I am trying to write a function with takes a vector of
> pair and an key (integer).
> it should return true if the input key matches the
> FIRST value of the map.
>
> bool containsPair(vector< pair<int, int> >& aMap, int
> key ) {
> return ( find_if ( aMap.begin(), aMap.end(), bind(
> equal_to<int>(), boost::lambda::bind( &pair< int,
> int>::first_type::first, boost::lambda::_1) , key ) )
> != aMap.end());
>
> }
> But i cant' get the code to compile.

Use bind( &pair<int, int>::first, _1 ) == key.


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