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
_______________________________________________
Cplusplus-sig mailing list
[email protected]
https://mail.python.org/mailman/listinfo/cplusplus-sig