Boost logo

Boost :

From: John Barnard (barnard_at_[hidden])
Date: 2000-12-12 16:05:59


David,

Ullrich sent me a reply, so my original message must have gotten
through. Ullrich's reply combined with a missing const declaration
cured my problem.

It may be helpful in the virtual function segment of the BPL
documentation to modify the pure virtual function example to

(1) include a constructor def for baz_class, i.e., add the line

baz_class.def(boost::python::constructor<>())

to the initfoobar definition

(2) add a constructor to baz_callback, i.e., add the line

baz_callback(PyObject* self) : m_self(self) {}

to the definition of baz_callback

Because I was wrapping a pure abstract class, I assumed that the
wrapper class (e.g., baz_class) shouldn't have a constructor. I
believe the example will still compile without (1) (but not without
(2)), but you won't be able to subclass baz in Python and use
instances of such a subclass in C++ (which is what
my problem was about).

John

-- 
John Barnard
Assistant Professor
Department of Statistics
Harvard University
Phone: (617) 495-1603
Fax:   (617) 496-8057
Email: barnard_at_[hidden]

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