Re: C++ Template Metaprogramming - factorial example

I wrote:
After spending some more time on this I now believe the code is broken.
There's some uncertainty because mpl::multiplies<> has apparently been
either renamed or replaced with mpl::times<>, and only the latter is
documented in the MPL Reference Manual, so I'm not certain whether or
not the two behave identically. However changing "multiplies" to
"times" didn't seem to make any difference in terms of the compilation
errors, so in the analysis that follows I'm making the assumption that
if there is any difference, it isn't doesn't change anything relevant
to the problem at hand.
According to the MPL Reference Manual, in an expression of the form
mpl::times

Brad Austin wrote:
With the modified include directive, the code compiles fine for me on GCC (MinGW) 3.2.x, 3.3.x and 3.4.x.
This is as good a place as any to bring up the question. You posted on a weekend; now that it's over you should get an anser soon. Jonathan

Brad Austin writes:
You are right.
They do. 'multiplies' is simply a synonym for 'times'.
Correct.
Ditto.
More precisely, it doesn't in the "official" 1.32.0 codebase. In the Boost distribution on the CD 'eval_if' _derives_ from the result metafunction, and that's probably how this and may be a few other factorial examples slipped through our tests. Removal of the inheritance for GCC (as an implementation detail) was a last-minute fix just before 1.32 was officially released.
Not if T7 and T8 are Integral Constants, see http://www.boost.org/libs/mpl/doc/refmanual/equal-to.html. -- Aleksey Gurtovoy MetaCommunications Engineering
participants (3)
-
Aleksey Gurtovoy
-
Brad Austin
-
Jonathan Turkanis