Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2001-03-17 23:40:53


From: David Abrahams <abrahams_at_[hidden]>
> From: "Greg Colvin" <gcolvin_at_[hidden]>
>
> > I meant no conflicts with other uses of the same wart.
> > If you use the same name for two different entities in
> > the same scope you lose. So don't do that.
>
> In my example below the names are not in the same scope:
> int ::f();
> char* ::B<int>::f();

Yes, you are right, sorry. Even so, I am not about to
adorn my member names with silly warts, but will use a
this-> where needed. But I admit that I still cannot
understand this example, and chalk it up to templates
just being weird sometimes.

> > Various
> > warts and naming conventions can help avoid the mistake,
> > but none are perfect. In template code, as you said,
> > this-> is the most reliable approach.
> >
> >
> > > Maybe one:
> > >
> > > int f();
> > >
> > > template <class T>
> > > struct B {
> > > char* f();
> > > };
> > >
> > > template <class T>
> > > struct X : B<T> {
> > > void g() {
> > > char* p = f(); // not B<T>::f!
> > > }
> > > };
> > > int main() {
> > > X<int> x;
> > > x.g();
> > > }
> > >
> > >
>
>
>
> List-Unsubscribe: <mailto:boost-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>


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