Boost logo

Boost :

From: Sven Van Echelpoel (sven.vanechelpoel.sv_at_[hidden])
Date: 2002-04-29 09:37:49


before I start, I should mention that I only followed the Loki::SmartPtr
discussion from afar and the SmartPtr implementation I'm talking about
is still the original Loki version and not some port in CVS, so my
comments may no longer apply. I apparently also missed the discussion on
smart_resource. After reading Phil's post on the handling of general
resources by SmartPtr I thought I'd throw my comments into the group.

One thing that has always bothered me about Loki::SmartPtr is how the
storage policy is used to destroy "resources". The thing with most OS
resources I have to use (about a zillion different HANDLE's on Win32) is
that the only thing that differs for each resource is how it is

So if I were to use Loki::SmartPtr I'd have to create a storage policy
for each resource type, although they only differ in the function that
has to be called to destroy the resource. Granted, one could conceive a
"generic" storage policy that forwards the destruction to the required
API function, or something similar. But since the storage policy is the
last template parameter, I'd have to specify all other policies, even
though I agree with the supplied defaults.

So of course you can use Loki::SmartPtr for all types of resources, it
is in general impractical for anything that isn't allocated from the
free store.


If you can remain calm while all others around you are losing their
heads, maybe you just don't understand the problem.

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