Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2002-07-24 12:53:48


"Philippe A. Bouchard" <philippeb_at_[hidden]> wrote in message
news:ahll99$qam$1_at_main.gmane.org...
> I made some modifications to squad_ptr<> that enables assignments
> to derived pointers.

You're missing squad_dynamic_cast<> which shared_ptr<> has. Look
at shared_ptr.hpp to see what I mean.

> [...]
> Ok then... What about a multithreaded application that manages
> thousands of transactions with a duration dependent on different
> opinions from different places?

Well, first you have to ask yourself if you can afford to not use raw
pointers. If you can, you then have to ask whether you can afford to
use a semi-generic smart pointer, or if you should be customizing
the pointer type for that application, which clearly has special needs.

> Inconsistancy I've noticed: the whole point of policy-based design is
> *choice*... but my preferences towards speed / memory gains with
> operator new (size_t, void *) in a flexible way are shoved away.

Policy-based design allows for a lot of variation. I suspect you have
not checked out the book I mentioned (it's definitely worth a read).
If I had a need for such performance, I would try to write a policy
set myself. However, I don't feel the added performance justifies
the trouble of writing and testing a policy set. I'm fairly sure there
is a way do your special allocation with one of the policy pointers
in the vault. Also, Andrei posted the Smart Pointer chapter of his
book on the Addison-Wesley site(?). Check the archives to find it,
if you don't want to read the whole book.

Dave


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