[C++-sig] Py++: Derived class and class templates
Roman Yakovenko
roman.yakovenko at gmail.com
Wed Aug 22 19:34:06 CEST 2007
On 8/22/07, Luca Sbardella <luca.sbardella at gmail.com> wrote:
> Hi,
> I just started testing Py++ and excuse me if questions are trivial.
>
>
> i) First question. I have the following class
>
> class timegrid: public dataserie<double> {
> public:
> timegrid() {}
> timegrid(double T1, double T2, long partitions)
> {init(T1,T2,partitions);}
> private:
> void init(double T1, double T2, long partitions);
> };
>
> which derives from the class template "dataserie".
> When I run Py++ (from the gui) I obtain a wrapper class which only include
> the timegrid methods (in this case the constructors) and no sign of methods
> derived from the template (and there are quite a lot)!!!!
>
>
> ii) Second question. Running Py++ on a template produce nothing (I guess it
> make sense). Is there something I'm missing?
The problem is that you cannot expose template functions/classes. Take
a look on next FAQ:
http://language-binding.net/pyplusplus/documentation/how_to.html#how-to-automatically-export-template-functions-class
You can also to take a look on Py++ Boost.Random example. This library
is "one big template", still it was very easy to expose it with Py++:
Usage example:
http://language-binding.net/pyplusplus/documentation/how_to.html#how-to-automatically-export-template-functions-class
Source code:
http://tinyurl.com/2p8nfd
http://tinyurl.com/3cr3ds
HTH.
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
More information about the Cplusplus-sig
mailing list