|
Boost Users : |
From: dlux42
Date: 2003-02-10 18:22:31
And what if you use the deallocator as a template parameter?
+ It does not cost extra space
+ Don't need to use an extra reference-counted pointer
- The interface is not consistent with shared_ptr
How about that? I would be happy to see this advancement in the
scoped_ptr class.
Anyway: Do you know any smart-pointer class, which supports custom
deallocator and can transfer ownership? (auto_ptr does not support
custom deallocator and either smart_ptr or shared_ptr does not support
release() method).
--- In Boost-Users_at_[hidden], "Peter Dimov" <pdimov_at_m...> wrote:
> From: "Black Ice" <yg-boost-users_at_g...>
> > As following manner:
> > template<class D> scoped_ptr(Y * p, D d);
> >
> > Any suggestion are appreciated.
>
> Scoped_ptr is intentionally kept as simple as possible to minimize
overhead.
> A custom deallocation feature as above would require either doubling its
> size or making its operator* perform a double indirection.
>
> If you need the custom deallocator feature, use shared_ptr.
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