[C++-sig] Pyste typedef problems...
Nicodemus
nicodemus at globalite.com.br
Mon Mar 31 22:29:15 CEST 2003
Giulio Eulisse wrote:
>>Have you ever tried to wrap a function returning a reference to an
>>unsigned int without using pyste? What would you expect the result
>>to be?
>>
>>
>
>mmm...Ok,you are right...It's not the typedef, it's the unsigned int...
>And it's not pyste related. Sorry about that.
>Now, is there a solution for that or I cannot deal with unsigned int at
>all? Again, I'm not really interested in writing a wrapper for it, if
>there is no way out I will just exclude the function.
>
>Ciao,
>Giulio
>
When I test your example, Pyste generates a warning for you:
]pyste --module=A A.pyste
---> Error: A::f returns a pointer or a reference, but no policy was
specified.
So you have to specify a police for that function. Please look at the
documentation for that. For this particular function, you have to write:
A = Class("A", "A.h")
set_policy(A.f, return_value_policy(copy_non_const_reference))
since you can't change the value of b, because integers are immutable in
Python.
More information about the Cplusplus-sig
mailing list