From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2004-09-16 11:16:55
"David Abrahams" <dave_at_[hidden]> wrote
> > REGISTER_TEMPLATE(type,2,(typename,int)) or
> > REGISTER_TEMPLATE(type,(typename)(int))
> I generally dislike interfaces that require counting, so prefer #2.
> However, in MPL's new assertions we were able to avoid the big
> problems with parenthesization and commas in the PP by actually using
> a parenthesized macro argument to form the argument list of a function
> type, so in:
> BOOST_MPL_ASSERT((is_same<std::pair<int,int>, B>))
> a function type is formed, something like:
> int (*)(is_same<std::pair<int,int>, B>)
> I don't know whether that's possible in this case, but if so it's a
> significant usability win.
I am afraid this will not help in this particular case, since we need all
the items separately. For example, in my implementation, "unsigned int" is
converted to something like BOOST_TYPEOF_unsigned_int, which expands into a
PP sequence containing items necessary to create the case for unsigned int.
OTOH, "typename" or "class" is converted to another PP sequence.
The differences between resulting PP sequences are on the PP level, for
example to extract the result of decoding one of the following has to be
typename X::type; // for typename/class
X::value; // for integrals
This kind of differences have to be resolved at PP time.
OTOH, I might be missing some other posibilities...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk