Pregunta

I'm having some trouble expanding to the base value

# include <boost/preprocessor/cat.hpp>

#define REL_ITERATION_1 1
#define REL_FRAME_ITERATION(i) BOOST_PP_CAT(REL_ITERATION_, i)
#define REL_ITERATION_PARAMS_2 REL_FRAME_ITERATION(1)
#define REL_FRAME1(i)           BOOST_PP_CAT(REL_ITERATION_PARAMS_, i)
#define REL_FRAME2(i)           REL_ITERATION_PARAMS_##i
REL_FRAME1(2)
REL_FRAME2(2)

Here's the output.

BOOST_PP_CAT(REL_ITERATION_, 1)
1

Does anyone have any idea why the first call is not the same as the second? I thought I had a handle on using the preprocessor, but I just don't get this. :(

¿Fue útil?

Solución

Never mind. I missed the part in the documentation where it says if it expands to a BOOST_PP_CAT() macro, it won't expand it.

Doh!

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top