From: "Duane Murphy"
I am trying to make a member function call to all objects returned by an iterator. mem_fn is giving me an error when trying to call get_pointer() for a reference object. There is no overload for get_pointer of a reference object. Is there some reason or should I be doing this differently.
[...]
Here is some pseudo code to get things in the right orientation.
class obj { public: void method(); };
class obj_iterator { public: obj& iterator::operator*() const { return obj_; } };
class obj_container { public: obj_iterator begin(); obj_iterator end(); }
{ ... obj_container c; foreach( c.begin(), c.end(), mem_fn( method ) ); }
Your code works, when modified appropriately. mem_fn recognizes obj&
references.
The following modification, however, does not work (which might be your
problem):
#include