Hi, Is there a short cut for bind(&class::method_name, this, _1)? I could wrap it in a macro, as I use it enough, but is there something nicer I'm missing? I often just do the for loop as it is a little more readable, maybe... For example, for( some_collection::iterator i = check_list.begin(); i!= check_list.end(); ++i ) { turn_off_calcs(*i); } Is hopefully the same as for_each( check_list.begin(), check_list.end(), lambda::bind(&instrument_store::turn_off_calcs,this,lambda::_1) ); Regards, Matt.
In our last exciting episode "Hurd, Matthew" wrote:
Hi,
Is there a short cut for bind(&class::method_name, this, _1)? I could wrap it in a macro, as I use it enough, but is there something nicer I'm missing?
I don't think you're missing anything. The code you show is the way to do it. I just wish operator. or operator-> would be freely overloadable. Jaakko
I often just do the for loop as it is a little more readable, maybe...
For example,
for( some_collection::iterator i = check_list.begin(); i!= check_list.end(); ++i ) { turn_off_calcs(*i); }
Is hopefully the same as
for_each( check_list.begin(), check_list.end(),
lambda::bind(&instrument_store::turn_off_calcs,this,lambda::_1) );
Regards,
Matt.
Monday, August 25, 2003, 7:30:50 PM, Jaakko Jarvi wrote: JJ> In our last exciting episode "Hurd, Matthew" wrote:
Is there a short cut for bind(&class::method_name, this, _1)? I could wrap it in a macro, as I use it enough, but is there something nicer I'm missing?
JJ> I don't think you're missing anything. The code you show is the way to JJ> do it. I just wish operator. or operator-> would be freely overloadable. JJ> Jaakko operator-> *is* overloadable. -- Steve Love: steve.love@essennell.co.uk ACCU - accu.org Promoting Professionalism in Programming
In our last exciting episode Stephen Love wrote:
Monday, August 25, 2003, 7:30:50 PM, Jaakko Jarvi wrote:
JJ> In our last exciting episode 'Hurd, Matthew' wrote:
Is there a short cut for bind(&class::method_name, this, _1)? I could wrap it in a macro, as I use it enough, but is there something nicer I'm missing?
JJ> I don't think you're missing anything. The code you show is the way to JJ> do it. I just wish operator. or operator-> would be freely overloadable.
JJ> Jaakko
operator-> *is* overloadable.
It is, but not freely. The return type cannot be arbitrary, say a lambda_functor type, making it not very useful for the LL. Cheers, Jaakko
-- Steve Love: steve.love@essennell.co.uk
ACCU - accu.org Promoting Professionalism in Programming
participants (3)
-
Hurd, Matthew
-
Jaakko Jarvi
-
Stephen Love