dimanche 24 décembre 2017

Using BOOST_PP_SEQ_FOR_EACH to define macros

In the example in boost's documentation about BOOST_PP_SEQ_FOR_EACH the show how to use BOOST_PP_SEQ_FOR_EACH and (w)(x)(y)(z) to expand to w_ x_ y_ z_. http://ift.tt/2pmeaBv This is nice but I need it to expand to

#define w _
#define x _
#define y _
#define z _

If I use #define MACRO_DEFINE(r, data, elem) #define elem data and BOOST_PP_SEQ_FOR_EACH(MACRO_DEFINE, _, SEQ) I get the following compilation error error: '#' is not followed by a macro parameter. Any idea how to do it?

Aucun commentaire:

Enregistrer un commentaire