Boost logo

Boost :

Subject: [boost] generic pointers, was: Re: [smart_ptr] shared_ptr template type
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2009-07-21 16:56:28


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 14 July 2009, Frank Mori Hess wrote:
> The code is in the file generic_shared.hpp (a fork of shared_ptr.hpp from
> trunk) which is located in the sandbox directory:
>
> https://svn.boost.org/trac/boost/browser/sandbox/fmhess/boost/smart_ptr
>
> The file can be copied into the main boost tree (I've been testing it with
> trunk). There is also a shared_ptr.hpp in the same directory, which
> implements shared_ptr on top of generic_shared. I used that mainly so I
> could do some testing of generic_shared using the shared_ptr tests
> unmodified. The tests pass, except for those which use
> enabled_shared_from_this or weak_ptr. Beyond that, I've played around a
> little with a few basic tests that use a user-defined pointer type, and
> also use a list iterator as the pointer type (with a deleter that uses the
> iterator to erase the element from its list).
>
> So, the current status is: no generic_weak (analogous to weak_ptr) yet, and
> no shared_from_this support. Also, there is an unresolved issue with
> respect to casting for non-plain old pointer types. generic_shared tries
> to apply boost::static/const/dynamic_pointer_cast to its pointer type, but
> ADL doesn't work for boost::static/const/dynamic_pointer_cast, and
> specialization won't work either. It seems I'll need to add a ADL hook for
> casts as suggested at the end of this thread:
>
> http://lists.boost.org/Archives/boost/2006/06/106406.php
>
> so user-defined pointer types can be support casting.

A little status update: I've got generic_weak and
enable_generic_shared_from_this done, and now all the smart_ptr library tests
pass (with the exception of one test that uses enable_shared_from_this2)
using wrappers for shared_ptr/weak_ptr/enable_shared_from_this which are
built on top of generic_shared/generic_weak/enable_generic_shared_from_this.
Pointer casts for non-plain old pointer types works now also. There's no
documentation or tests though (beyond the smart_ptr tests).

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpmK30ACgkQ5vihyNWuA4VTLwCgkLACR5WGHKnXQQQ8zd+FIGEp
wN0AnR3eakDRViY+eOuhyFXer/QxbwAL
=M/Hu
-----END PGP SIGNATURE-----


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk