Boost logo

Boost Users :

From: dlux42 dlux_at_[hidden])
Date: 2003-02-17 06:56:56


> The main reason that scoped_ptr doesn't provide this feature is that
nobody
> made a convincing case for it.
>
> (An example of a convincing case: "In my project I have encountered the
> following situation: <description with real(istic sounding)
identifiers> and
> I believe that scoped_ptr<X, D> would be a perfect fit." Some
non-examples:
> "Someone might find it useful." "Wouldn't it be cool if...")
>
> I suspect that most people just use editor inheritance or specialize
> ~scoped_ptr.

I am now working on a project, where I use scoped_ptr and shared_ptr.
shared_ptr works well on most tasks, but I often need to instantiate
Xerces classes, which are used only locally, and must be release()-d
at the end of the procedure.

I wrote a custom_auto_ptr<X, D> class for only this reason, but I
think scoped_ptr<X, D> would be the perfect solution for it. (I use
custom_auto_ptr, not custom_scoped_ptr, because these are basically
the same, except the release(), method, which could be useful in the
future).

> No. auto_ptr<X, D> would indeed be useful, but many compilers can't
handle
> the machinery that is needed to build an auto_ptr, which is probably why
> there are few auto_ptr reimplementations and enhancements around.

Hmmm. shared_ptr and scoped_ptr (and my custom_auto_ptr) work
flawlessly on HP-UX aCC. Do you know a compiler which is even more
worse than that? :-)


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net