[C++-sig] Cplusplus-sig Digest, Vol 76, Issue 6

Botos, Christopher CBotos at aer.com
Mon Feb 23 20:35:56 CET 2015


Well, I'm embarrassed.  I don't believe I did that.  Thanks so much!
________________________________________
From: Cplusplus-sig [cplusplus-sig-bounces+cbotos=aer.com at python.org] on behalf of cplusplus-sig-request at python.org [cplusplus-sig-request at python.org]
Sent: Monday, February 23, 2015 6:00 AM
To: cplusplus-sig at python.org
Subject: Cplusplus-sig Digest, Vol 76, Issue 6

Send Cplusplus-sig mailing list submissions to
        cplusplus-sig at python.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://mail.python.org/mailman/listinfo/cplusplus-sig
or, via email, send a message with subject or body 'help' to
        cplusplus-sig-request at python.org

You can reach the person managing the list at
        cplusplus-sig-owner at python.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Cplusplus-sig digest..."


Today's Topics:

   1. Re: Wrapping virtual method returning void (Holger Joukl)


----------------------------------------------------------------------

Message: 1
Date: Mon, 23 Feb 2015 08:52:49 +0100
From: Holger Joukl <Holger.Joukl at LBBW.de>
To: Development of Python/C++ integration <cplusplus-sig at python.org>
Subject: Re: [C++-sig] Wrapping virtual method returning void
Message-ID:
        <OF2DB1123C.ACFE992C-ONC1257DF5.002A8ACD-C1257DF5.002B49AA at LBBW.de>
Content-Type: text/plain; charset=US-ASCII


Hi,

not boost.python- but C/C++ syntax-related.
You never reach the Base class call in your wrapper class:

 > struct SongWrapper :  Song, bp::wrapper<Song>
> {
>     void chorus()
>     {
>         if (bp::override chorus = this->get_override("chorus"))
>                 chorus();
>                 return;        <------------ Called unconditionally
>         Song::chorus();
>         return;
>     }
>
>     void default_chorus()    {  this->Song::chorus(); }
> };

I suggest using proper {} brackets and indentation with if-else constructs
for readability.

Your int-returning member function doesn't suffer from this problem:

>
> struct AnotherSongWrapper :  AnotherSong, bp::wrapper<AnotherSong>
> {
>     int chorus()
>     {
>         if (bp::override chorus = this->get_override("chorus"))
>                 return chorus();
>         return AnotherSong::chorus();
>     }
>
>     int default_chorus()   {  return this->AnotherSong::chorus(); }
> };

Holger

Landesbank Baden-Wuerttemberg
Anstalt des oeffentlichen Rechts
Hauptsitze: Stuttgart, Karlsruhe, Mannheim, Mainz
HRA 12704
Amtsgericht Stuttgart



------------------------------

Subject: Digest Footer

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig at python.org
https://mail.python.org/mailman/listinfo/cplusplus-sig

------------------------------

End of Cplusplus-sig Digest, Vol 76, Issue 6
********************************************

________________________________

This email is intended solely for the recipient. It may contain privileged, proprietary or confidential information or material. If you are not the intended recipient, please delete this email and any attachments and notify the sender of the error.



More information about the Cplusplus-sig mailing list