|
Boost Users : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-09-30 09:37:02
From: "Alan M. Carroll, CodeSlinger" <yg-boost-users_at_[hidden]>
> "Peter Dimov" <pdimov_at_[hidden]> wrote in message
> news:005401c26614$5b478cb0$1d00a8c0_at_pdimov2...
> >
> > OK, but you are arguing for shared_ptr<T> to T* comparisons, not for a
> void
> > const * conversion. The right way to support these comparisons is by
> > defining the appropriate operators. If you want to "lobby" for
> shared_ptr<T>
> > == T*, please do so on the developer list, I've no problem with that.
:-)
>
> I'm not arguing for anything. This is a technique I picked up that I found
> useful because it, in a single method, provides a number of useful
features.
> I was simply curious as to why Boost didn't use the technique. I presumed
> that it was obvious enough that it had been considered and rejected. After
> searching, I was unable to find any rational for not using it, so I asked
> here. My goal was to understand the logic behind that decision. You have
> explained clearly why you prefer to not use it in a generic smart pointer
> implementation so that achieves my goal.
I see. :-)
In case my explanation didn't really convince you, consider that ((void
const *)p) == q is, in general, not the same as p == q when p and q are
pointers to different types. It appears to work in most cases and that makes
the problem even harder to find when it finally surfaces.
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