|
Boost Users : |
From: JaeWook Choi (zzzz.ooo_at_[hidden])
Date: 2006-02-19 13:04:59
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" <pdimov_at_[hidden]>
Newsgroups: gmane.comp.lib.boost.user
Sent: Sunday, February 19, 2006 8:23 AM
Subject: Re: member data pointer and nested bind
> 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