Re: [pygccxml-development] Template type instances as default values
Brought to you by:
mbaas,
roman_yakovenko
|
From: Roman Y. <rom...@gm...> - 2008-03-30 05:42:09
|
On Sat, Mar 29, 2008 at 9:28 PM, Matthias Baas <mat...@gm...> wrote:
> Hi,
Hello
> I have a problem wrapping a template class whose member functions have
> default values that are objects of a template type... well, what I mean
> is best shown on an example:
>
> class A
> {
> public:
> int v;
> };
>
> template<class T>
> class B
> {
> T value;
> public:
> B(T a=T()) : value(a) {}
>
> void foo(T a=T()) {}
> };
>
> inline void instantiation()
> {
> B<A> b;
> }
>
>
> When I create bindings for classes A and B, Py++ produces source code
> that doesn't compile.
> The problem is the default value in the constructor of B and the foo()
> method. The values are instances of template class T which should be A
> in the above example. But Py++ actually writes "T()" into the source
> code which, of course, is not declared and produces a compile error.
> I suppose in a case like this Py++ should recognize that the expression
> for the default value uses a template type and replace it with the
> actual type that was used in the instantiation.
> I don't know if this is easy to do, but I could imagine that it is not
> quite trivial...
>
> So what do you think, could Py++ handle this all alone or do I have to
> replace the default value myself somehow?
Py++ couldn't handle this :-(. I suggest you to read this
thread(http://www.gccxml.org/pipermail/gccxml/2008-February/001059.html).
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
|