|
Boost Users : |
Subject: [Boost-users] [lambda] instantiation in bind
From: Igor R (boost.lists_at_[hidden])
Date: 2009-07-20 14:24:41
In VC9.0 the following code gives the error message:
1>...\boost\tuple\detail\tuple_basic.hpp(419) : error C2259: 'Base' :
cannot instantiate abstract class
If the Base is not abstract, the code compiles and works as expected.
Unfortunately, I'm unable to realise why it tries to instantiate the
Base, and how to overcome this issue, so any enlightenment would be
greatly appreciated!
class Base
{
public:
virtual void close() = 0;
};
class Derived : public Base
{
public:
void close()
{}
};
#include <boost/shared_ptr.hpp>
typedef boost::shared_ptr<Base> BasePtr;
typedef boost::shared_ptr<BasePtr> BasePtrPtr;
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
namespace bl = boost::lambda;
BasePtrPtr makeHolder(Base *base)
{
return BasePtrPtr(new BasePtr(base), bl::bind(&Base::close, **bl::_1));
}
int main()
{
Base *b = new Derived();
makeHolder(b);
return 0;
}
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net