macros - __VAR_ARG__: how can i get the arguments count?

using __VAR_ARG__, how can i get the number of arguments?
see these to similar macros:
1
2
3
4
5
6
#define ClassWithEvents(DerivedClass, MacroEventsUsed, InstanceName) \
                class InstanceName : public DerivedClass {public: MacroEventsUsed}InstanceName;

#define ClassWithEventsWithConstructor(DerivedClass, MacroEventsUsed, InstanceName, __VA_ARG__) \
                class InstanceName : public DerivedClass {public: InstanceName():DerivedClass(__VA_ARG__){;} \
             ~InstanceName(){;}  MacroEventsUsed}InstanceName; 

the big diference here is if use the last parameter or not.
i don't know all macros. but can anyone advice me?
Last edited on
I think the first __VA_ARG__ should be ... and the second one should be __VA_ARGS__.
thank you so much
is what i need:
1
2
3
#define ClassWithEvents(DerivedClass, MacroEventsUsed, InstanceName, ...) \
                class InstanceName : public DerivedClass {public: InstanceName():DerivedClass(__VA_ARGS__){;} \ 
                ~InstanceName(){;}  MacroEventsUsed}InstanceName;

thank you so much
Last edited on
Topic archived. No new replies allowed.