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

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:
> 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:
> 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).

Version: GnuPG v1.4.9 (GNU/Linux)


Boost list run by bdawes at, gregod at, cpdaniel at, john at