On 10/5/05, David Abrahams
Geoffrey Romer
writes: OK, your correction works, but I don't understand why. I thought that omitting the typename ... ::type syntax just creates a null-ary metafunction. For example,
pair
, at > seems to me like it would produce not a pair consisting of a char and an int_, but a pair consisting of a char and a null-ary metafunction which, when applied, produces an int_. Am I missing something?
The 2nd argument to plus above probably isn't what you think. You're passing it a nullary metafunction: at
.
Right, exactly, and as I understand it, that metafunction is never actually evaluated (at least, not in the above code), so the result is, as I said, a pair consisting of char and a nullary metafunction, not a char and an int_. If so, doesn't that mean Cromwell's fix is incorrect? I'm feeling generally very confused about the circumstances in which one does and does not use the typename...::type syntax. In addition to this problem, I'm finding that placeholder expressions seem to fail to compile if they contain typename...::type in places where I would expect it to be necessary, and when I remove that syntax they seem to produce correct results, even though they shouldn't.