[C++-sig] Py++ and inner template classes

Roman Yakovenko roman.yakovenko at gmail.com
Tue Apr 29 19:42:02 CEST 2008


On Tue, Apr 29, 2008 at 3:35 PM, Pertti Kellomäki
<pertti.kellomaki at tut.fi> wrote:
> Roman Yakovenko wrote:
>
> > This should help:
> > http://language-binding.net/pyplusplus/documentation/how_to/templates.html
> >
> > Basically you have to instantiate that class, sizeof operator does this.
> >
>
>  One more thing. Is it possible to do this non-invasively?

Yes

>I tried
>  to play around, but the only way I was able to get the inner template
>  class exposed was to put the sizeof() somewhere in the same header file
>  as the original class. I can do it if necessary, but I would prefer
>  not to clutter the original header file if possible.

You can create another header file and instantiate the class in it.
Then you can pass it to Py++. Take a look on this page:
http://www.language-binding.net/pyplusplus/documentation/how_to/best_practices.html

The short version: create header file, that belongs to "bindings
project" and include all other files from it. Instantiate the
templates within the file. Then pass this file to Py++.

HTH

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the Cplusplus-sig mailing list