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
#include
#include
#include
#include
#include <vector>
using namespace boost;
using namespace std;
struct A: public enable_shared_from_this<A>
{
static void myfunc(const A* in)
{
}
};
struct B: public A,
public enable_shared_from_this<B>
{
typedef shared_ptr<B> tBptr;
};
int main (void)
{
vector v;
B::tBptr p(new B());
v.push_back(p);
p.reset(new B());
v.push_back(p);
//error cannot deduce argument
for_each (v.begin(),v.end(), boost::mem_fn(&A::myfunc));
return 0;
}
--
V S P
toreason@fastmail.fm
--
http://www.fastmail.fm - A fast, anti-spam email service.