[C++-sig] [solved]custom smart pointers

Roman Yakovenko roman.yakovenko at gmail.com
Tue Sep 19 22:59:50 CEST 2006


Hi. Few weeks ago I asked for help to solve problem with custom smart pointer.
David Abrahams helped me to solve all the problems I had. He pointed me to
the bugs in my code. Yes! There was no problem with Boost.Python, but with
my code.

I attach to this mail few files:
* smart_ptr.h - contains definition of my smart pointer
* classes.h - contains definition of base( abstract ) and derived classes
* bindings.cpp - contains code that exposes base and derived classes to Python
* test.py - test suite, defines 2 classes, one that derived from base
and another
                 one that derives from "derived" class
* sconstruct - scons build script

I hope you( Boost.Python user) will be able to learn from the code and
also to use
it to test your own smart pointer.

You can find the source code in Py++ repository:
http://svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/unittests/smart_ptrs/

Comments, suggestions, new tests or just thoughts are welcome.

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bindings.cpp
Type: text/x-c++src
Size: 2412 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060919/78c5cb73/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: classes.hpp
Type: text/x-c++hdr
Size: 935 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060919/78c5cb73/attachment.hpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sconstruct
Type: application/octet-stream
Size: 326 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060919/78c5cb73/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smart_ptr.h
Type: text/x-chdr
Size: 2007 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060919/78c5cb73/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.py
Type: text/x-python
Size: 1694 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060919/78c5cb73/attachment.py>


More information about the Cplusplus-sig mailing list