Boost logo

Boost :

From: Murray Cumming (murrayc_at_[hidden])
Date: 2001-08-17 07:56:45


Peter Dimov wrote:
>
> From: "Murray Cumming" <murrayc_at_[hidden]>
> > I'd like to use the shared_ptr smart pointer, but the underlying types
> > that I am using have their own specific *_alloc() and *_drop() functions
> > instead of using new/delete.
>
> Another mandatory link to
>
> http://groups.yahoo.com/group/boost/files/smart_ptr/
>
> The variant in shared_ptr_updates.zip can do
>
> shared_ptr<my_type> p(my_alloc(), &my_drop);

No, I think that's enough because allocation/deallocation is rarely that
simple.

For instance, for the freaky Sybase client library that I'm wrapping:

- The allocation functions don't just return the instance. The instance
pointer is an input argument and the result is a success/error code.
- Some allocation functions require extra data/instances, so my smart
pointer has a non-default constructor that actually allows me to specify
an *instance* of an allocator. e.g.:

Connection::Connection(Context& context)
  : Base<CS_CONNECTION, Allocator_Connection>(new
Allocator_Connection(context))
{
}

>
> You only need to convince Beman that this is a good idea. :-)
>
> --
> Peter Dimov
> Multi Media Ltd.
>
> Info: http://www.boost.org Unsubscribe: <mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

-- 
Murray Cumming
www.murrayc.com
murrayc_at_[hidden]

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