Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2002-10-08 14:29:20


"Peter Dimov" <pdimov_at_[hidden]> wrote in message
news:00e501c26efc$e6e95320$1d00a8c0_at_pdimov2...
> From: "David B. Held" <dheld_at_[hidden]>
> > Should these be in their own file, perhaps?
>
> I don't see why, if you are talking about the (shared|sp)_static_cast
> functions.

Yes.

> > I'd like to use the detail::*_cast_tags without creating my own and
> > without having a dependency on shared_ptr<>.
>
> The tags are really only an implementation detail. We can move them to -
> say - detail/cast_tags.hpp but why should different smart pointers use the
> same tag classes?
> [...]

They don't need to necessarily. It's just convenient. It seems that the
casting operations should be pointer-independent (possibly with
overloads for raw pointers). Then, any custom pointer type could simply
overload boost::sp_*_cast<>, and code that uses those casts can drop-in
replace raw or smart pointer types. So I see the tag classes as an
implementation detail to the end user, but an interface detail for library
writers. Of course, there's nothing wrong with making different cast
tags, but since those are perfectly good names, why make new ones?
I'd rather share. ;)

Dave


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