[C++-sig] Instantiated template class exported to python

Nicolas.Rougier at loria.fr Nicolas.Rougier at loria.fr
Tue Feb 14 08:24:12 CET 2006


Thanks a lot and yes it makes more sense !
I just completely forgot to provide those constructors.

For the archive:

line class VecInt : public Vec<int> {}
should be replaced by
class VecInt : public Vec<int> {
public:
    VecInt (PyObject *self) : Vec<int> (self) {}
    VecInt (PyObject *self, const VecInt &other) : Vec<int> (self,other) {}
};

Finally, the reason I export the VecInt instead of Vec<int> is that I was not
sure in the first place how to write the back_reference stuff using template
(but in fact, it is quite straightforward).


Nicolas


> You try to export 'VecInt' as a class with back reference, however
> that class doesn't provide the required constructor taking a PyObject
> pointer.
> Only its base class 'Vec<int>' does, but that obviously can't be used to
> construct
> a VecInt. Is there any reason you export VecInt instead of Vec<int> ?
>
> Does this make more sense ? :-)
>
> Regards,
> 		Stefan
>






More information about the Cplusplus-sig mailing list