|
Boost : |
From: Rob Stewart (stewart_at_[hidden])
Date: 2004-05-21 12:11:03
From: "David B. Held" <dheld_at_[hidden]>
> "Rob Stewart" <stewart_at_[hidden]> wrote in message
> > [...]
> > int * p1(0);
> > int const * p2(p1); // OK
> >
> > Notice also that T for instrusive_ptr<T> and for T * is one and
> > the same, so you can't compare intrusive_ptr<T> with T const *.
> > You could only compare intrusive_ptr<T const> with T const *.
>
> And the problem with that is?
The original query was why the second arg wasn't T const *. My
point is that comparing with a T * would work because T * can be
converted to T const * implicitly.
The other point is that if you have an instrusive_ptr<int const>,
for example, you cannot compare it with an int *, because the
function template expects the second argument to be of type int
const *. (Actually, it will just complain about not being able
to infer T since neither int nor int const will work.)
-- Rob Stewart stewart_at_[hidden] Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk