Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-08-17 08:39:37

From: "Murray Cumming" <murrayc_at_[hidden]>
> Sorry, I read that as 'address of myalloc', instead of 'myalloc()'. This
> might be enough, though it's less flexible. In particular, a custom
> allocator would allow more use of a deallocator function that took args.

'bind' can help with this:

shared_ptr<sybase_context> p(my_create_connection(constructor-args),
bind(&my_destroy_connection, destroy-args));

> > It's not as elegant as a dedicated smart handle class, granted. If you
> > decide to go that route you'll find that detail/shared_count.hpp does
> > of the work for you. :-)
> That's not very obvious to me.

I don't have the time at the moment to write the documentation for
shared_count (it looks like it deserves boost:: status) but I'd probably
have to if my proposed changes to shared_ptr are accepted.

For now, simply take a look at

Most of it is boilerplate code that supports the shared_ptr specific
interface. The real work is done by the shared_count member 'pn'. You can
easily adapt shared_ptr into a sybase-specific smart handle.

Of course I don't want to imply that your allocator idea is not worth

Peter Dimov
Multi Media Ltd.

Boost list run by bdawes at, gregod at, cpdaniel at, john at