
On 17 March 2011 03:33, Gruenke, Matt <mgruenke@tycoint.com> wrote: ... the possibility of templates which parameterize both the object lifetime management policy and pointer validity (or non-null-ness, at least). Whether it would be worthwhile is a separate question. I think the issue of semantics, showing intent, suggesting behavior is very relevant. Perhaps the name subscribed_ptr describes the usage and mechanics better than valid_ptr does? Matt <mgruenke@tycoint.com> wrote: ... put a shared_mutex in valid_target<> and hide some locking in accesses via valid_ptr<> (i.e. put a scoped_lock in a temporary object returned by valid_ptr<>'s operators) ... Unfortunately, I don't see how that would be better than weak_ptr<> Right now, I agree. I think thread safety is beyond the ambitions of valid_ptr which should be intentionally light weight. On the flip side, there are plenty of MT programs out there that don't use reference counting smart pointers and get by fine. Matt <mgruenke@tycoint.com> wrote: the same thing could be accomplished by using weak pointers to an object whose refcount had been manually incremented by 1. When you want to kill it, one of the referers could then manually decrement the refcount, so that it gets killed when it goes back to idle. valid_ptr should not be able to release it's target object by design - it is not a memory management pointer.