
Hello Peter,
Thank you so much. It seems both solutions are working well.
BTW, Is there any links that explain the differences /or commons between
boost::bind & boost::lambda::bind in their usage? It isn't quite easy for a
newbie to look through boost source code to figure all that.
Thanks again.
Jae.
----- Original Message -----
From: "Peter Dimov"
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.