Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2006-12-18 16:32:08

Larry Evans <cppljevans_at_[hidden]> writes:

> Maybe a caution like:
> If the intended result of applyn<X,a1,>::type
> is X<a1,> then to assure this result, there should
> be, within the body of X, a nested:
> typedef X type;
> otherwise, if X<a1,...,an> has a supertype with such a
> nested typdef, it will be used instead of the intended
> result.
> within:
> would avoid misunderstandings like mine.

Maybe, but inheriting a nested ::type is such a fundamental pattern of
use with MPL that I'm surprised you could have misunderstood this.

>From the point of view of a client of X,

     struct X { typedef int type; };


     struct Y { typedef int type; };
     struct X : Y {};

are entirely equivalent.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at