[C++-sig] class_::add_property flexiablity
David Abrahams
dave at boost-consulting.com
Tue Dec 3 06:17:42 CET 2002
Jeff,
1. Please post a reproducible C++ test case, with Python code which
demonstrates the problem
2. Please try to limit the amount of quoted text in replies. In
particular, please don't quote the digest header ;-)
Jeff Holle <jeff.holle at verizon.net> writes:
> c++-sig-request at python.org wrote:
>
>>Send C++-sig mailing list submissions to
>> c++-sig at python.org
>>
>>To subscribe or unsubscribe via the World Wide Web, visit
>> http://mail.python.org/mailman/listinfo/c++-sig
>>or, via email, send a message with subject or body 'help' to
>> c++-sig-request at python.org
>>
>>You can reach the person managing the list at
>> c++-sig-admin at python.org
>>
>>When replying, please edit your Subject line so it is more specific
>>than "Re: Contents of C++-sig digest..."
>>
>>
>>Today's Topics:
>>
>> 1. class_::add_property flexiablity (Jeff Holle)
>> 2. Re: class_::add_property flexiablity (David Abrahams)
<snip>
>>
>>Jeff Holle <jeff.holle at verizon.net> writes:
>>In reading your referenced html pages, I "fell into" this:
>>
> .add_property("Name",make_function(&Widget::getName,
> return_value_policy<copy_const_reference>()));
>
> It compiles without errors, but produces unacceptable runtime behaviours.
> Amongest them is that this doesn't produce an error:
>
> import TestAddProperty
> widget = TestAddProperty.Widget
> widget.Name = "this is a test"
> print widget.Name
> Note that I haven't provided a mutator.
>
> I've subsequently investigated enough to know that my C++ method is
> not being called.
>
> What is the correct thing to do?
>
> The other question is why did this obviously incorrect thing compile?
> Given this behaviour, the documentation needs to be much better...
>
>
--
David Abrahams
dave at boost-consulting.com * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution
More information about the Cplusplus-sig
mailing list