Boost logo

Boost :

Subject: Re: [boost] [bind] virtual function pointer woes
From: Jon Biggar (jon_at_[hidden])
Date: 2009-01-09 11:47:52


Chris wrote:
> As far as I know, no. If you find a true answer, please tell me.
> I had this problem once as well and looked into it on the newsgroups.
> There may be a non-portable way with the vtable and asm, but not
> generally. My suggestion would be to make a split
>
> _nv function that does the call
>
> struct B { virtual void f() { f_nv(); } void f_nv()
> {std::printf("B\n"); } };
> struct D : B { virtual void f() { f_nv(); } void f_nv() {
> std::printf("D\n"); } };
>
> And then bind _nv;

Or just create a new free function:

inline void call_B_f(D &d)
{
     d->B::f();
}

boost::bind(&call_B_f, _1)(d);

-- 
Jon Biggar
jon_at_[hidden]
jon_at_[hidden]

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk