« Return to Thread: [smart_ptr] shared_ptr template type

Re: [smart_ptr] shared_ptr template type

by Andrey Semashev-2 :: Rate this Message:

Reply to Author | View in Thread

Frank Mori Hess wrote:

> I wonder if it might be better/possible to have a shared_ptr<T> that didn't
> assume its corresponding "raw" pointer type was T* but rather T.  For
> example, what is now a shared_ptr<int> would be specified as a
> shared_ptr<int*>.  The motivation would be to allow support for other classes
> as the "raw" pointer type.  For example, I might want to have a
> shared_ptr<monitor<T*> > where the monitor<T*> has an operator->() which does
> automatic locking/unlocking of a mutex before/after forwarding the
> operator->() to the plain T pointer.

Why not having monitor_ptr< T > contain the shared_ptr and implement
operator-> the way you described? Making shared_ptr templated on a
pointer type is way unusual compared to other smart pointer types.
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

 « Return to Thread: [smart_ptr] shared_ptr template type