From: Dave Abrahams (abrahams_at_[hidden])
Date: 2000-01-12 19:45:18
> * The smart pointer needs to support construction from a raw pointer
> when other smart pointers to the same object are known to exist, but
> are not available. This means there needs to be a constructor which
> increments the reference count rather than just setting it to 1.
> (This need derives from a really nice cache design which holds raw
> pointers rather than smart pointers. If smart pointers where held,
> the cached pages would never get released.)
That doesn't force us to have an intrusive reference-count (unless I
misunderstand the meaning of "not available"). What it forces is some way of
getting to the count for existing objects which are already being counted.
You could store that association in a hash table.
I have already been in communication with Greg about that possibility,
because twice colleagues of mine have made the mistake of initializing a
smart_ptr with a raw pointer to an object which is already being counted.
One of the engineers was senior.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk