[C++-sig] Re: problem with overloaded address operator

David Abrahams dave at boost-consulting.com
Thu Dec 9 14:34:48 CET 2004


Fred Houben wrote:

> From: "David Abrahams" <dave at boost-consulting.com>
>>
>> > I've downloaded the latest version of boost.python from the cvs server.
>> > It seems that the problem of overloaded address operators shifts from
>> > pointer_holder.hpp( v1.30.2) to to_python_indirect.hpp (latest cvs).
>> > Replacing U* const p = &const_cast<U&>(x) with U* const p =
>> > const_cast<U*>(boost::addressof(x)) fixes the problem.
>> > I'm really not that familiar with the boost.python library, but this seems
>> > the only change needed.
>> > If someone can point out other possible problems with overloaded address
>> > operators in boost.python, let me know.
>> >
>> > I've included the patched to_python_indirect.hpp.
>>
>> ?? This appears to be pointer_holder.hpp ??
>>
>> Do you know how to create a patch file?  One easy way is to make
>> changes in your CVS image and then do a "cvs diff -du" from the
>> top directory.
>
> Okay I've created a patch to fix the problem.

Thanks; are you sure that's all that's needed?  The pointer_holder.hpp
you sent also was using addressof().

Also, would you mind contributing a testcase for libs/python/test that
fails to compile without your patch?

Thanks again,

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com




More information about the Cplusplus-sig mailing list