[PySide] Cannot pass enum by reference

John Cummings jcummings2 at users.sf.net
Wed May 30 20:50:39 CEST 2012

On 05/30/2012 01:09 PM, Hugo Parente Lima wrote:
> It can be passed by value unless it's a const reference, otherwise the
> following code wont work.
> enum ValEnum { One, Other };
> void oneOrTheOtherEnumValue(ValEnum&  enumValue) {
>      enumValue = Other;
> }
> ValEnum a = One;
> oneOrTheOtherEnumValue(a);
> // a should be equal to Other.
> This is why Shiboken tries to use a pointer, but the code seems wrong anyway
> :-/.

The subject of the thread was incorrect before. Sorry for the confusion.

Your statement "It can be passed by value unless it's a const reference" is 
circular. Passing by value is by definition not passing by reference. Perhaps I 
don't understand your statement.

It also doesn't matter if the reference is const or not in this case, the 
current Shiboken still does not create a correct wrapper. Old versions did.

John Cummings

More information about the PySide mailing list