[C++-sig] Python-overridable method taking const ref?
Roman Yakovenko
roman.yakovenko at gmail.com
Thu Feb 5 06:00:56 CET 2009
On Thu, Feb 5, 2009 at 4:56 AM, David Abrahams <dave at boostpro.com> wrote:
>
> on Wed Feb 04 2009, Paul Melis <pyplusplus-AT-assumetheposition.nl> wrote:
>
>> Hello,
>>
>> Classes with protected destructors (as found when custom reference
>> counting is used) seem to cause some trouble when using bp::wrapper<>
>> containing a method that takes a const reference to a refcounted class.
>>
>
>> struct CallbackWrap : Callback, bp::wrapper<Callback>
>> {
>> void execute(const Thing& t)
>> {
>> if (bp::override ovr = this->get_override("execute"))
>> {
>> fprintf(stderr, "have override, calling...\n");
>> ovr(t);
> ^^^^^^
> The problem is here, right?
Not only. As you know, "const T&" allows Boost.Python to create
temporal object and than call the function, so I guess the compilation
error was arrived from that functionality.
If you take a look on my first answer, this is exactly what I did and
it didn't help, at least not on GCC 4.3.
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
More information about the Cplusplus-sig
mailing list