|
Boost Users : |
From: Gottlob Frege (gottlobfrege_at_[hidden])
Date: 2007-01-28 21:55:21
On 1/27/07, Tobias Schwinger <tschwinger_at_[hidden]> wrote:
> Ovanes Markarian wrote:
> > Just a small addition. You can also specialize the template in another
> > file, that is seen in the translation unit.
>
> Be aware, however, that it's not necessarily a good idea:
>
> If you forget to #include the specialization definition, an
> instantiation of is_pointer_like<T>::value can be both 'false' and
> 'true' in the same program. This scenario can lead to strange effects
> that are not necessarily caught at compile time.
>
> You should at least add a forward declaration of the class template
> specialization to the header defining the smart pointer (but you might
> as well just define the specialization in this case because it's trivial).
>
> Regards,
> Tobias
>
I think, at the end of the day, that it would be nice if smart ptrs
derived from some tag classes describing their traits, just like
iterators, containers, unary/binary functions, etc should/do.
ie smart_ptr_tag, weak_ptr_tag, etc.
Tony
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net