Is there a way to make the C++ preprocessor join arguments with a joiner token?
I've learned that I can do:
#include <boost/preprocessor/seq/cat.hpp>
#define arg1 foo
#define arg2 bar
#define arg3 baz
BOOST_PP_SEQ_CAT((arg1)(_)(arg2)(_)(arg3))
to get foo_bar_baz.
I have two questions:
- Is there a way to do it for without the repeated explicit joiner
characters (
(_)) and for an argument list of variadic length? Is it necessary to pass the arguments like so:
(arg1)(arg2)(arg3)Can I wrap it in another macro that'll allow me to pass argument normally, i.e.?:
arg1, arg2, arg3
##as glue without the parentheses and the joiner characters. - Tobias##preprocessor operator? - Some programmer dude#define COMPOSE(...)) TheBOOST_PP_SEQ_CATmacro works with arbitrarily long lists. I just don't know how to insert the joiner character into the concatenation. - PSkocik