Boost logo

Boost :

From: Phil Nash (phil.nash.lists_at_[hidden])
Date: 2003-02-20 09:10:35


[Anthony Williams]
> 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.

Precisely :-)
I think a big obstacle at the moment is the lack of typedef templates.
Without these the important smart_ptr specialisation/ partial instantiation
becomes a little more awkward. However I think this awkwardness can be
contained to the implementation (which can be substituted to the cleaner
design when template typedefs are available). See the earlier threads in the
PBSP discussion (esp. about 6 or 7 months back) for ways this can be
accomplished.

I may have missed out on interest when I brought this up before because I
insisted that smart_resource be separate and parallel to smart_ptr, whereas
I agree that it is more natural for smart_ptr to be subset of
smart_resource.

Maybe this turn of the thread should be promoted to its own so that the PBSP
community at large has more visibility of it? I don't know how many of the
usual contributors to those threads are busy with release-oriented duties at
present.

Regards,

[)o
IhIL..


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