|
Boost : |
From: Alisdair Meredith (alisdair.meredith_at_[hidden])
Date: 2003-02-19 04:58:51
Gennadiy Rozental wrote:
> Mutex locking is a simple example of resource management idiom. All flavors
> of resource management are easily implemented in terms of policy based smart
> pointers (don't allow name to confuse you). In this particular case most
> probably all that you need is a custom StoragePolicy. Now you can enjoy all
> the variety of ownership policies supplied with smart_ptr or design your own
> for very specific needs.
To use an old English idiom, I think you are putting the cart before the
horse [as did Modern C++ Design, IMNSHO]
Resource protection is a useful concept, and pointers are simply another
resource that needs protecting. It makes little sense to dereference a
mutex, for instance. This is one of the defining concepts of a pointer.
Rather, I think if we seek a generic implementation the 'base' concept
is resource protection, and smart pointers are a refinement of this
concept.
-- AlisdairM
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk