Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-09-03 05:38:00

Two observations: (sorry for not responding in the thread, I was too quick
with the Del key.)

Policy-based smart pointers:

There is a break-even point past which a custom smart pointer constructed by
defining the appropriate policies becomes harder to write, more error prone,
less readable and less efficient compared to simply implementing the class
from scratch. And coming up with a good policy-based design (one with a
reasonable break-even point) is difficult.

This is especially true in cases like the one described, where the focus is
on efficiency, not semantics.

Self-reset() a no-op:

With an extended shared_ptr with a custom 'finalizer', reset() changes not
only the contained pointer, but reverts to using the default 'delete px'
finalizer (by default; it should probably have an additional argument.) I'm
not sure how self-reset should be handled in this case.

I still prefer the simpler semantics of shared_ptr(p).swap(*this) (as if.)
They apply to reset() and all assignment operators.

Peter Dimov
Multi Media Ltd.

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