Hi, I am trying to use the preprocessor lib to generate something like
Cons<a, Cons<b, Cons<c, Cons<d, Nil> > > >
from
(a) (b) (c) (d)
I tried something like
#define START(x) Cons<x,Nil>
#define ADD(s,state,x) Cons<x,state >
#define GENERATE(x) BOOST_PP_SEQ_FOLD_RIGHT(ADD,START(BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_REVERSE(x))),BOOST_PP_SEQ_POP_BACK(x))
but immediately got into trouble with the commas. The best I can do is to add parentheses around the content of START and ADD, but that generated
(Cons<a, (Cons<b, (Cons<c, (Cons<d, Nil>) >) >) >)
which is not valid.
Is there any way I can achieve the desired output? Thanks,
Di,
Yu
10.30