[C++-sig] Best way to register shared_ptr<const T>

Roman Yakovenko roman.yakovenko at gmail.com
Thu Jan 24 20:05:27 CET 2008


On Jan 23, 2008 10:28 PM, Andrea <mariofutire at googlemail.com> wrote:
> Hi,
>
> I've run into the problem of registering a shared_ptr<const T>.
> I've found a workaround using a const_cast in get_pointer.
>
> I've also read that there exist a patch to implement a proper fix.
>
> Unfortunately I cannot find more details on that.

Read this thread:
http://mail.python.org/pipermail/c++-sig/2006-November/011664.html

> Could someone please quick list pros and cons of both approaches.
> I am a bit uncomfortable about const_casting, but I cannot understand if it is just a way to please
> the compiler or something deeper.

I attach the original patch

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pointer_holder.hpp.patch
Type: text/x-patch
Size: 3094 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20080124/29122c58/attachment.bin>


More information about the Cplusplus-sig mailing list