Let's have
class Item{
public:
Item(int id,const char *name,const char *props=NULL);
};
And I want to write:
ITEM(1,FIRST);
ITEM(2,SECOND, WithSomeProps);
With a macro
#define ITEM(ID,NAME,...) new Item(ID,NAME, #__VA_ARGS__ )
That #__VA_ARGS__
compiles well on gcc but gives an error on VStudio. Is there a solid and portable solution?
I want to have a collection of ITEM()
in a .h file that will be included several times with different #definitions of ITEM
.