|
Boost : |
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2002-04-19 12:27:48
<DKl_at_[hidden]> wrote in message
news:904AA220ACB4D211A10600104B3E85C92A82CC_at_MAIL...
> Andrei Alexandrescu wrote:
> > I'm not sure what you are suggesting. At the end of the day, they
> > _will_ be different types, be it through specialization or whatever.
>
> What do you mean with 'shared_ptr<T>' and 'shared_ptr<T>' will be
> different type? 'shared_ptr<T1>' and 'shared_ptr<T2>' may use
> different policies and they are different types, of course. Whether
> 'shared_ptr<T>' uses an intrusive or an external counter, for example,
> is invisible and up to the configuration.
If you will have templated typedef it could be done like this:
typedef
template<typename T> smart_ptr<
some algorithm for StoragePolicy deduction<T>,
some algorithm for OwnershipPolicy deduction<T>,
...
> I_do_not_know_what_name;
>
> My point is that there should be one smart pointer type to be used for
> passing "pointers" to 'T' around: This type appears in interfaces. It's
> exact definition, ie. the management policies used, may vary between
> types (eg. be intrusive for some types, be external for other types).
> However, using a 'shared_ptr<T>' for some types and an
> 'instrusive_ptr<T>' for other types is a bad idea: For example, generic
> interfaces unaware of special type properties are likely to use a
> 'shared_ptr<T>' while interfaces with specific knowledge are likely to
> use 'instrusive_ptr<T>'. Unfortunately, these two types are
> incompatible and objects produced by one component cannot be used with
> functions of the other component. This is a bad idea.
We can always make them compartible.
Gennadiy.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk