Reputation: 13267
Following is the my C++ class
namespace X {
class ChildFactory: public Father {
public:
static ChildFactor* createChildFactory(const properties* ptr = NULLPTR);
private :
// no instances allowed
ChildFactory();
ChildFactory(const properties* ptr);
~ChildFactory();
};
};
following is how I have defined the Boost::Python
constructs.
BOOST_PYTHON_MODULE(TestPy)
{
boost::python::class_<X::ChildFactory, boost::noncopyable>("ChildFactory")
.def("createChildFactory", &X::ChildFactory::createChildFactory, boost::python::return_value_policy<boost::python::manage_new_object>() )
.staticmethod("createChildFactory")
;
}
But it is giving me weird compiler template error.
Error is
destructor could not be generated because a base class destructor is inaccessible
Upvotes: 2
Views: 1947
Reputation: 414835
manage_new_object
might use auto_ptr<>
which requires delete pointer_to_ChildFactory
to work which needs access to ~ChildFactory()
.
Upvotes: 0
Reputation: 31597
Try exposing your class as having no_init
:
class_<Foo, boost::noncopyable>("Foo", no_init);
Upvotes: 1
Reputation: 104
destructor could not be generated because a base class destructor is inaccessible
So did you solve it?
If not, what that means it is you declared your constructor function in the private
section of the class, thats why it can not be accessed. In fact you can not instantiate that class, it can only be used as a singleton.
Move your
ChildFactory();
~ChildFactory();
to the public section and lets us know.
Upvotes: 0