Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2006-01-28 20:45:21


> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Tobias Schwinger

BOOST_PP_IF(1, BOOST_PP_ENUM_PARAMS(3, p), blah)

> Note:
> - BOOST_PP_IF does not get disabled

IF getting disabled doesn't matter here. The entire ENUM_PARAMS invocation
occurs on entry to IF--where IF is not get disabled.

> - lazy invocation => no repetition in the "else-case".

This one is closer to the actual problem. ENUM_PARAMS is an intermediate if the
repetition count is higher than one. An "intermediate" is a single argument
that expands to multiple arguments--which creates pathological input that IF
cannot deal with:

#define IF(cond, t, f) IIF(BOOL(cond), t, f)

When IF is invoked, the argument for 't' (in particular) gets expanded prior to
substitution of 't' in the replacement list of IF (long before IIF is invoked).
This results in:

IIF(BOOL(1), p0, p1, p2, blah)

Which is clearly too many arguments to IIF.

Regards,
Paul Mensonides


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