$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Arias Brent-P96059 (Brent.Arias_at_[hidden])
Date: 2004-11-17 16:25:11
I've invented a printable enum, based on the Boost preprocessor programming lib. But although the printable enum works, I think my efforts revealed a bug in Boost.
The BOOST_PP_SEQ_ENUM preprocessor macro doesn't work with the empty "false"
result of BOOST_PP_EXPR_IIF. This has forced me to do hacks like this:
#define ENUM(name, start, entries)\
BOOST_PP_SEQ_ENUM( \
BOOST_PP_IIF(ENUMS, \
(typedef enum{ BOOST_PP_SEQ_HEAD(entries) = start) \
BOOST_PP_SEQ_TAIL(entries) \
(LAST_##name } name;) \
, \
(static void PP_NILFUNC();) \
) \
)
As you can see in the above definition, I've included an explicit "false" clause for BOOST_PP_IIF() that expands into the harmless (and utterly superfluous) expression "static void PP_NILFUNC();". I would instead have preferred to use BOOST_PP_EXPR_IIF and thus avoid the eye-sore. But the hack was necessary, as I said before, because BOOST_PP_SEQ_ENUM does not elogantly handle the empty "false" result of BOOST_PP_EXPR_IIF.
Can this be fixed?
-Brent