|
Boost Users : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-02-19 08:23:35
JaeWook Choi wrote:
> vector<CTestClass>::iterator it_f1 =
> find_if(vecTestClass.begin(), vecTestClass.end(),
> bind(::PtInRect, &bind(&CTestClass::rc, _1), ptTest) ); //
> compile error!
You can't use &bind with boost::bind, only with boost::lambda::bind. If you
want to keep using boost::bind:
template<class T> struct address_of
{
typedef T* result_type;
result_type operator()( T & t ) const { return &t; }
};
vector<CTestClass>::iterator it_f1 =
find_if(vecTestClass.begin(), vecTestClass.end(),
bind( ::PtInRect, bind( address_of<RECT>(), bind(&CTestClass::rc, _1) ),
ptTest ) );
If you switch to lambda::bind you might have problems with the __stdcall
convention that PtInRect uses; bind<BOOL>( ::PtInRect, ... ) might get you
around that.
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