|
Boost : |
From: Knut-Håvard Aksnes (knut_at_[hidden])
Date: 2000-03-29 04:42:27
Ian Bruntlett writes:
> Kevin,
>
> > And this means....... How exactly is auto_ptr not sufficient. I really
> > don't know what you are trying to do. What are your existing practices.
>
> Well, I don't think auto_ptr<> would be suitable for use when dealing with,
> say O.S. handles.
>
> I think that to use auto_ptr<> with an O.S. handle I'd have to write a guard
> class for every kind of O.S. handle.
>
> It would only be a matter of time before individual guard classes started
> having different interfaces and quirks.
>
> If I use auto_resource<>, I'd only have to implement two member functions,
> reset() and release(). The class interface would be consistent - as long as
> reset() and release() were implemented correctly.
>
An example from my current project could illuminate this. (Using
CORBA)
In one of my methods I need to create a temporary CORBA object. This
object must be released at exit by invoking one of its methods. In
this case a scoped_ptr like behavior is of interest, in other
situations such remote resources could be pooled by several local
objects, in such situations a shared_ptr like behavior is what's
needed.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk