Hello,
I need help again.

In the example below I either get the error message during compilation:
> ...
>/home/mihail/temporary/boost_1_37_0/boost/python/object/value_holder.hpp:66: 
>error: cannot declare field 
>‘boost::python::objects::value_holder<A0>::m_held’ to be of abstract type ‘A0’
>boost.cpp:5: note:   because the following virtual functions are pure within 
>‘A0’:
>boost.cpp:7: note:     virtual void A0::pure()

or, if I don't expose class A0 (as it is currently commented out), when 
importing the module in python:
> <type 'exceptions.RuntimeError'>: extension class wrapper for base class A0 
> has not been created yet

How can I fix the problem? I don't need to expose A0, well, exposing pure 
classes doesn't make sense anyway, does it?
But I need to be able to call in python boost_ext.B(boost_ext.A()), so that I 
think I have to declare the A0<-A inheritance relationship somehow.

Thank you
Mihail

boost.cpp:

// A is a concrete implementation of the abstract class A0.
// the constructor of B<T> takes the abstract class A0
class A0{
public:
  virtual void pure()=0;
  virtual ~A0(){};
};

class A: public A0{
public:
  void pure(){};
  ~A(){};
};

template<class T> class B{
  T value;
public:
  B(const A0&){};
};

typedef B<double> Lumi;

BOOST_PYTHON_MODULE(boost_ext)
{
    using namespace boost::python;
    //class_<A0>("A0");
    class_<A,bases<A0> >("A");
    class_<Lumi>("Lumi",init<const A0&>());
}



      

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to