Boost logo

Boost Users :

From: Geoffrey Romer (geoff.romer_at_[hidden])
Date: 2005-10-05 11:06:11


On 10/5/05, David Abrahams <dave_at_[hidden]> wrote:
> Geoffrey Romer <geoff.romer_at_[hidden]> 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<char, plus<int_<1>, at<m_map,char> >
> >
> > 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<m_map,char>.

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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net