c++boost-preprocessor

c++ concatenate macro1 text with comma and with macro2


From these macros:

#define X abc
#define Y def

how can I define macro Z the content of which is:

abc,def

?

I couldn't manage with

#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/punctuation/comma.hpp>
#define ZZ BOOST_PP_CAT(X,BOOST_PP_COMMA)

this produces just:

abcBOOST_PP_COMMA

Solution

  • You can simply write:

    X,Y
    

    That will do the trick.