[C++-sig] custom smart pointers

David Abrahams dave at boost-consulting.com
Tue Sep 12 05:26:05 CEST 2006


"Roman Yakovenko" <roman.yakovenko at gmail.com> writes:

> On 8/31/06, David Abrahams <dave at boost-consulting.com> wrote:
>> >From this I can't understand what you're doing or what errors you're
>> getting.  Please do what I tell everyone to do: make a _complete_,
>> _minimal_ example that reproduces your problem and post that.
>
> I attached 3 files. This is complete and minimal example.

It's hardly minimal!

A minimal example would have no "documentation" strings, no use of
named arguments (bp::arg(...)) and no use of things that you get by
default anyway, like default_call_policies.  It would not contain
extraneous implicit conversions from int.  This is a problem with many
code generators: they create an unreadable mess for anyone who wants
to understand the result.  Part of the reason many people despise the
MFC Wizards.  I suggest you fix Py++ so it doesn't add vacuous
"documentation" and other needless cruft.

In a minimal example, there would be just one .cpp file, one .py file,
and if possible, a Jamfile I can use to build and run the test.

BTW, your #include guards use identifiers that are reserved to the C++
implementation.

I made your example work.  I had to add an operator* to your smart
pointer, although I think that uncovers a bug in Boost.Python: we
should be using get_pointer where it needed the operator*, instead.

I don't know if this meets your needs or not, but the result is
enclosed.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.tar.gz
Type: application/octet-stream
Size: 1839 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060911/c627c087/attachment.obj>
-------------- next part --------------

HTH,

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com


More information about the Cplusplus-sig mailing list