[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-cpp-sig
Subject:    [C++-sig] returning reference to enum
From:       etaurel () cells ! es (Emmanuel Taurel)
Date:       2005-11-22 13:18:00
Message-ID: 0IQC008BUYAS63 () cells-s02 ! cells ! es
[Download RAW message or body]

Hello,

I can't change the class therefore, as suggested I have used the
copy_non_const_reference ResultConverterGenerator.
It works fine. Thank's for the tip but in this case, my enum is copied in a
new Python object. Is this correct ?

A last question for my understanding. Why using return_internal_reference
works fine when returning a reference to an already wrapped class (like in
the return_internal_reference documentation example) and it does not when
returning an enumeration ?

Thank's for your answer

Emmanuel Taurel (etaurel at cells.es)

-----Original Message-----
From: c++-sig-bounces@python.org [mailto:c++-sig-bounces at python.org] On
Behalf Of Roman Yakovenko
Sent: Tuesday, November 22, 2005 12:44 PM
To: Development of Python/C++ integration
Subject: Re: [C++-sig] returning reference to enum

On 11/22/05, Emmanuel Taurel <etaurel at cells.es> wrote:
> Hello everybody,
>
> I have a very simple example where I try to wrap a C++ class. In this
class
> there is a method which returns a reference to an internal variable which
is
> an enumeration. I try to wrap this method with the
return_internal_reference
> Call Policy but I have a compiler error.
>
> Any idea welcome. Thank's very much in advance

If you can change the class, then change it to return that enum value by
value.
In this case you don't need to specify call policies.

If you can not to change it, then return_value_policy<
copy_non_const_reference > will do the job.

>
>
> Emmanuel Taurel (etaurel at cells.es)
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
>
>
>
_______________________________________________
C++-sig mailing list
C++-sig at python.org
http://mail.python.org/mailman/listinfo/c++-sig


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic