[Q] error with shared_ptr, for_each, boost::mem_fn
Hi,
I cannot resolve why boost::mem_fn does not appear to be able to resolve
to a pointer (or a reference) from a smart pointer to a derived object
(My understanding is
that get_pointer in boost::shared_ptr is specifically available so that
boost::mem_fn can work)
Here is the example of code and line with error (Visual Studion 2008 32
bit)
Thank you in advance for any help
----------------------------------------------
#include <iostream>
#include
AMDG V S P wrote:
struct A: public enable_shared_from_this<A> { static void myfunc(const A* in); };
for_each (v.begin(),v.end(), boost::mem_fn(&A::myfunc));
A::myfunc is a static member function, so mem_fn doesn't work. If you declare it as a non-static member void myfunc() const; it works. In Christ, Steven Watanabe
participants (2)
-
Steven Watanabe
-
V S P