Boost logo

Boost :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-07-16 13:20:05


AMDG

Robert Jones wrote:
> Is it possible to bind to pure virtual methods? Like this
>
> <snip>
>
> My compiler seems to be complaining that s is abstract, which is
> surely not a real limitation!
>

This is a unfortunate problem with Boost.Lambda's return type
deduction mechanism. See also http://svn.boost.org/trac/boost/ticket/426.

You can work around it by passing a pointer.

#include <boost/lambda/bind.hpp>
#include <boost/lambda/lambda.hpp>

struct S {
    virtual void methodOfS() = 0;
};

void f( S & s ) {
    using namespace boost::lambda;
    bind(&S::methodOfS, _1)(&s);
}

In Christ,
Steven Watanabe


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