Boost logo

Boost :

From: Jaap Suter (J.Suter_at_[hidden])
Date: 2003-01-02 01:20:45


> First thing to note is that you leave out "typename" all over the
> place. Try testing your examples with GCC-3.2.

Yeah, I noticed. I had the same problem when porting my own code from Intel
to GCC. Strange that the strongly-conforming Intel compiler doesn't issue a
warning for it.
Fixed in the WIKI.

> Second thing: you can save yourself lots of typenames by taking
> advantage of the way MPL lets you pass an uninstantiated metafunction,
> without getting its nested ::type member, wherever a bool_c<...> is
> expected:

I did not know this. I do remember a previous MPL discussion about automatic
application of ::type but that was in a different context.
I updated the WIKI, but I also added a question there about this.

> Oh, your foo example seems to have too many "integral_c<"s in it:

Fixed.

> One more hint you should use as an item: "Use inheritance to forward
> metafunction results". So:

Awesome! I hadn't thought of this one before. Thanks!! And added to the
WIKI.
Small question: is struct inheritance public by default, or did you forget a
'public' there?

> Lastly, I know that Aleksey will argue with me about this, but I have
> a strong preference for "class" rather than "typename" in template
> parameter lists.

Haha, I did not add an item to the WIKI, because I don't think it's good to
promote something if even the MPL itself doesn't use it.
However, you did convince me, mostly because it allows me to do easier
global-search-and-replaces for typename to BOOST_DEDUCED_TYPENAME :) hehe.

Thanks,

Jaap Suter


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