From: Daniel Wallin (dalwan01_at_[hidden])
Date: 2004-01-02 07:23:33
David B. Held wrote:
> "Daniel Wallin" <dalwan01_at_[hidden]> wrote in message
>>Very useful for pimpl classes and for storing polymorphic objects.
> Looks like it could be spelled: smart_ptr<T, deep_copy>, if
> someone would ever finish that thing. ;)
Really? I'm assuming you mean that it could be spelled that way if
deep_copy was rewritten
(I'm looking at:
to support capturing of the pointee type at the time of construction.
But even then smart_ptr<> is lacking the:
const_pointer_type operator->() const
const_reference_type operator*() const
.. and maybe a templated reset().
needed to propagate constness. But then, const_pointer_type and
const_reference_type comes from the storage policy so we'd need one of
those too. And the storage policy also needs to capture the type to
properly delete the pointee.
So we end up with;
Unfortunatly both the storage and ownership policies need to capture the
type of the pointee, meaning they both need to store a function pointer.
So we'd end up with a smart pointer that is much larger than needed.
Am I wrong?
-- Daniel Wallin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk