From: Larry Evans (cppljevans_at_[hidden])
Date: 2004-07-12 16:33:19
On 07/12/2004 03:42 PM, Maciej Sobczak wrote:
> Exactly, that was my point. There are third-party APIs (and even
> operating system interfaces, like file descriptors) where resources are
> not handled by explicit pointers, but by "handles", which are usually
> lightweight copyable types.
> I guess that policy-based smart pointer design + template typedefs would
> solve this problem (and many others) definitely. :)
>> I think there might have been talk of getting a policy base smart
>> pointer to do this kind of thing as well.
>> I guess that nothing much has happened yet because the need isn't that
> Well, that depends on how you look at it.
> I'd risk a claim that 95% of programmers would need smart handles more
> often than, say, 50% of what is currently in Boost, especially
> considering the fact that smart handle would not be a foreign concept -
> this is just a smart pointer concept applied to generic resource. Quite
> common stuff, I think.
> Of course, your mileages may vary.
I've been thinking about generalizing it for reflection. For example,
for every type which is to be "reflected", the instances of that
type would be stored in a reflector handle. The "reflection" (i.e.
information on all the reflector handles) of a type, T, would be
stored in reflection<T>. This information is similar to that used
for garbage collection of cycles; hence, I think the code in:
could be used.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk