[C++-sig] abstract templates and pyste question.
Nicodemus
nicodemus at esss.com.br
Mon Feb 16 17:58:34 CET 2004
Hanz Meizer wrote:
> Dear list,
>
> I've tried to wrap an abstract template using pyste. Unfortunately, I
> somehow do not get it to work properly. Maybe there's someone out
> there who can help? Using boot-1.31. The main problem seems that I
> have a hierarchy of templates where the base template is abstract. I
> get tons of error messages, I assume I'd have to tell pyste that the
> base template has to have a no_init keyword. Unfortunately, I haven't
> found out how to do this.
>
> example template:
>
> ----------------------------------------------------
> template<class T>
> class PreProcessor
> {
> public:
> PreProcessor() {}
> virtual ~PreProcessor() {}
>
> virtual const int getSize(void) = 0;
> virtual T* getObject(int id) = 0;
> };
> ----------------------------------------------------
>
You have to create a Template, and the instantiate it for the types you
want:
PreProcessor = Template("PreProcessor", "preprocessor.hpp") # here no
class is exported yet
PreProcessor("float", "FPreProcessor") # instantiate PreProcessor with
T=float, and rename the
# instantiated class to
FPreProcessor
That should do it.
Regards,
Nicodemus.
> Can anyone tell me how to export such constructs using pyste? If that
> is not possible, maybe there's a working method for boost.python?
>
> H.
>
>
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
>
More information about the Cplusplus-sig
mailing list