Boost logo

Boost :

From: Anthony Williams (anthony.williamsNOSPAM_at_[hidden])
Date: 2003-02-20 08:09:41


"Phil Nash" <phil.nash.lists_at_[hidden]> writes:

> However, I still say that the overriding issue here is simply that of
> *name*. Smart pointers and resource wrappers are, and still increasingly so,
> important concepts. Having such a confusing name->intent relationship is, to
> me, very counter-productive because it makes a concept (or concepts) that
> should be simplifying design into something confusing, even arcane. I'll say
> it again in as plain terms as I can:
>
> Smart pointers are examples (specialisations?) of smart resources Smart
> resources are not examples or specialisations of smart pointers.
>
> A NON POINTER resource managed by a smart POINTER is confusing and counter
> intuitive.
>
> It doesn't matter how well the interface fits.. That is not the issue
> (although I do still contend that there are some issues there too, if
> minor).

I agree. It would be nice to have a generic RAII framework that went beyond
ScopeGuard, and allowed for all the ownership semantics associated with the
various forms of smart pointer, whilst permitting the resource itself to be
something quite distinct from a pointer.

If the framework utilized a policy-based design, then you could supply
policies that extended the interface, so your generic RAII class looked like a
smart pointer when the resource it owned was indeed a pointer. It would also
allow for additional not-at-all-pointer-like interfaces to be added for the
case where the resource was something else which had a clear-cut interface
that was desirable.

Anthony

-- 
Anthony Williams
Senior Software Engineer, Beran Instruments Ltd.
Remove NOSPAM when replying, for timely response.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk