id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 4456,BOOST_PP_SEQ_FOLD_RIGHT completely broken,ookami1@…,No-Maintainer,"The following program is adapted from the macro BOOST_PP_SEQ_CAT that concatenates the elements of a sequence to a string: (a)(b)(c)(d) ==> ""abcd"" BOOST_PP_SEQ_CAT is built upon BOOST_SEQ_FOLD_LEFT; by analogy, one would expect that macro REVCAT, written after BOOST_PP_SEQ_CAT, but using BOOST_PP_SEQ_FOLD_RIGHT, builds a reversed string ""dcba"". This is not the case, in fact, the program does not even compile, because BOOST_PP_FOLD_RIGHT is currently completely broken. {{{ #include # define REVCAT(seq) \ BOOST_PP_IF( \ BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)), \ REVCAT_I, \ BOOST_PP_SEQ_HEAD(seq) BOOST_PP_TUPLE_EAT_1 \ )(seq) \ /**/ # define REVCAT_I(seq) BOOST_PP_SEQ_FOLD_RIGHT(REVCAT_O, BOOST_PP_SEQ_HEAD(seq), BOOST_PP_SEQ_TAIL(seq)) # # define REVCAT_O(s, st, elem) REVCAT_O_I(st, elem) # define REVCAT_O_I(a, b) a ## b const char x[] = BOOST_PP_STRINGIZE(BOOST_PP_SEQ_CAT((a)(b)(c)(d))); # pragma warning just a marker const char revx[] = BOOST_PP_STRINGIZE(REVCAT((a)(b)(c)(d))); }}} int main() { return *x == 0; } Here is the message from the compiler: Invoking: GCC C++ Compiler g++ -I""/home/wolf/workspace/booster"" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF""booster.d"" -MT""booster.d"" -o""booster.o"" ""../booster.cpp"" ../booster.cpp:15: warning: ignoring #pragma warning just ../booster.cpp:16:1: error: macro ""BOOST_PP_SEQ_ELEM_III"" requires 2 arguments, but only 1 given Note that the first call succeeds. Cheers Wolf Lammen ",Bugs,closed,Boost 1.44.0,preprocessor,Boost 1.44.0,Problem,invalid,,