std::for_each with member function as reference

Started by
10 comments, last by pointer 13 years, 7 months ago
Quote:Original post by Ryan_001
Just for the sake of conversation:

std::for_each(av.begin(), av.end(), [=] (ObjectA* a) { Apply(a); } );


This is pretty much why I've already migrated almost all my work to C++0x.
Advertisement
Quote:Original post by Zahlman
Umm... mem_fun_ref? :)


Isn't the difference between mem_fun_ref and mem_fun that the former creates a binder object that takes a first parameter of reference type, while the latter takes a pointer? Ie, 'this' is either bound to a reference or a pointer, and not the first argument to the method being called? Correct me if I'm wrong [smile]

This topic is closed to new replies.

Advertisement