[C++-sig] Re: abstract templates and pyste question.
Nicodemus
nicodemus at esss.com.br
Wed Feb 18 23:11:36 CET 2004
David Abrahams wrote:
>Nicodemus <nicodemus at esss.com.br> writes:
>
>
>>>There are two choices:
>>>
>>> 1. It can be no_init
>>>
>>> 2. PreProcessor_char_Wrapper must define getSize() and getObject()
>>>
>>>Clearly, whatever was generated by pyste does neither of these.
>>>
>>>
>>The Wrapper defines getSize() and getObject(), but not no_init, and
>>this compiles under msvc 6.0.
>>
>
>I don't see what vc6 has to do with this. The OP has a compilation
>error indicating that getSize and getObject are not defined in the
>wrapper.
>
>??
>
You're right, I didn't read the error message carefully. But Pyste does
generate the methods in the wrapper:
struct PreProcessor_float_Wrapper: PreProcessor<float>
{
PreProcessor_float_Wrapper(PyObject* self_, const
PreProcessor<float>& p0):
PreProcessor<float>(p0), self(self_) {}
PreProcessor_float_Wrapper(PyObject* self_):
PreProcessor<float>(), self(self_) {}
const int getSize() {
return call_method< const int >(self, "getSize");
}
float getObject(int p0) {
return call_method< float >(self, "getObject", p0);
}
PyObject* self;
};
// Module
======================================================================
BOOST_PYTHON_MODULE(temp)
{
class_< PreProcessor<float>, boost::noncopyable,
PreProcessor_float_Wrapper >("PreProcessor_float", init< >())
.def("getSize", pure_virtual(&PreProcessor<float>::getSize))
.def("getObject", pure_virtual(&PreProcessor<float>::getObject))
;
}
And this compiles fine under msvc 6.0. Perhaps the generated code by the
OP is different?
More information about the Cplusplus-sig
mailing list