Boost logo

Boost Users :

From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-08-11 13:28:26


Hi,

I'm using Boost.Preprocessor to create specializations of a class I have
named InputSource. in the iteration loop, I have the following:

# define i BOOST_PP_ITERATION()
# define INPUT_repeat(z, n, user) user

    template<typename t_return, BOOST_PP_ENUM_PARAMS(i, typename t_param)>
    class InputSource<
        t_return,
        BOOST_PP_ENUM_PARAMS(i, t_param)
        BOOST_PP_COMMA_IF( BOOST_PP_AND(BOOST_PP_NOT_EQUAL(i, 0),
BOOST_PP_NOT_EQUAL(i, MAX_PARAMETERS)) )
        BOOST_PP_ENUM(BOOST_PP_SUB(MAX_PARAMETERS, i), INPUT_repeat,
detail::no_param)
>

The part that isn't working is the BOOST_PP_COMMA_IF line. When I look at
the preprocessor output generated by MSVC9, I get this:

    template<typename t_return, typename t_param0>
    class InputSource<
        t_return,
         t_param0

BOOST_PP_IIF_BOOST_PP_BOOL_BOOST_PP_BITAND_BOOST_PP_BOOL_BOOST_PP_NOT_EQUAL(1,
0)BOOST_PP_BOOL_BOOST_PP_NOT_EQUAL(1, 5)(BOOST_PP_COMMA, BOOST_PP_EMPTY)()
         detail::no_param , detail::no_param , detail::no_param ,
detail::no_param
>

My iteration limits has been defined as follows:

# ifndef MAX_PARAMETERS
# define MAX_PARAMETERS 5
# endif

# define BOOST_PP_ITERATION_LIMITS (1, MAX_PARAMETERS)

I would have expected the preprocessor to show a comma or a blank line, but
instead it looks like some macros were not expanded. Any solutions to this
problem?



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