|
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,...an>::type
> is X<a1,...an> 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:
>
> http://www.boost.org/libs/mpl/doc/refmanual/placeholder-expression.html
>
> 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; };
and
struct Y { typedef int type; };
struct X : Y {};
are entirely equivalent.
-- Dave Abrahams Boost Consulting 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