|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2002-10-05 07:07:17
From: "Schoenborn, Oliver" <Oliver.Schoenborn_at_[hidden]>
> > From: Dave Abrahams
> > > From: "Larry Evans" <jcampbell3_at_[hidden]>
> > >
> > > >David B. Held wrote:
> > > >
> > > > >Deriving from ptr<T const> is a weird beast. For instance, if you
> declare
> > > > >T* p_; in ptr<T const>, for some reason, it is not visible in
ptr<T>,
> > > >
> > > >I'm totally surprised!
> >
> > It's a dependent base class. A conforming compiler will only
> > find it with qualification, e.g.
> >
> > this->p_
>
> I'm totally surprised too. This means that gcc 2.96, 3.2, and SGI's
MipsPro
> CC are non standard in this regard, which is possible I guess.
None of them implement 2-phase name lookup.
Metrowerks and more-recent EDGs are the only ones I know of which do.
Metrowerks is still missing a few cases in member templates.
> That said, I
> still don't see why the code that Dave Held wrote would require this->p_
> (how is ptr<T const> a dependent base class?).
template <class T> class Y { .. };
template <class T>
class X : Y<T>
{
};
The actual definition of Y depends on T:
template <> class Y<int> { ... };
likewise:
template <class T> class ptr;
template <class T>
class ptr<T const> {...};
template <class T>
class ptr : ptr<T const> { ... };
the actual definition of the base class depends on T:
template <> class ptr<int const> { ... };
-----------------------------------------------------------
David Abrahams * Boost Consulting
dave_at_[hidden] * http://www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk