vendredi 3 juin 2016

__VA_ARGS__ pass types and then type

i have a Macro that looks like the following

#define dofirst(...) setoptfirst(???); executefirstopt(__VA_ARGS__)

But now as you can see i want to parse the types of the va args at the position of the ???. Like for example that i can do:

dofirst(int,5);

or:

dofirst((int)5); (i would prefer the first but this is also okay)

So in the end the macro should run like that:

setoptfirst(int); executefirstopt(5);

Aucun commentaire:

Enregistrer un commentaire