0

I want to define a series of macro arguments as a macro, but I don't know if this is achievable.

So, for example,

#define PARAMS "Hillow", " whirled"
#define TEST(p1, p2) p1 p2

void test() 
{   
   char* c = TEST(PARAMS);
}

What I want, of course, is for PARAMS to expand before TEST is called. But instead, PARAMS is treated as a single parameter, and what I get is

char* c = "Hillow", " whirled";

The motivation is to define a macro which is a list of types, and other macros which perform operations on those types. I'm aware of boost::mpl::vector, but I'd personally prefer it this way if possible, because it is less verbose, comprehensible by mortals, and it won't break any compilers.

Tyson Jacobs
  • 352
  • 1
  • 9
  • [How are you compiling?](http://coliru.stacked-crooked.com/a/6064aa96d99605c9) Anyway, depending on what exactly you want, something like [this](http://coliru.stacked-crooked.com/a/b8c184f865eb5f30) could work. – chris May 04 '14 at 01:01
  • What do you actually need this for? I'm not sure I understand the usage. – Shoe May 04 '14 at 01:14
  • ughoavgfhw: it is, thanks, my mistake. – Tyson Jacobs May 04 '14 at 01:31

0 Answers0