Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2003-02-05 17:39:18


Peter Dimov wrote:
> Howard Hinnant wrote:
>> Custom deleter policy + implicit conversion policy - converting
>> constructors - converting assignment operators == smart pointer that
>> handles arrays.
>
> - operator*
> - operator->

Not these two--at least not for any reasons that I see.

> - static_cast
> - dynamic_cast
> - incomplete type support
> - auto_ptr construction/assignment

It isn't necessary to explicitly disable all these things that are centered
around polymorphic behavior. It would just be wrong to use them, just like it
is wrong to use an array polymorphically (for any element but the first). The
use of arrays in a way managed by a smart pointer is perfectly acceptable. The
issues involved with polymorphism and arrays are problems with certain array
usages. The same applies to smart pointers to arrays. It is not _necessary_ to
prevent that kind of use. However, you *can* prevent many things simply by
having a each interface member function validate against each policy, but it
isn't absolutely necessary because the behavior would already mimic the built-in
behavior. Each policy could define a flag type to prohibit a certain operation
from being used. Whether or not that flag type exists is detectable.
Therefore, static assertions can be used to prevent certain operations from
compiling in a way that is non-intrusive to all other unrelated policies.

Paul Mensonides


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