Boost logo

Boost Users :

Subject: [Boost-users] [preprocessor] have macro do different things based on structure of its argument
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2011-03-02 04:11:07


Hello,
 
I would like to write a macro MY_MACRO(x) that does different things based on
the structure of its input, e.g. something different for each of the following
forms:
 
MY_MACRO(x) // a single token
MY_MACRO((x, y)) // a parenthesized list of two tokens
MY_MACRO((x, y, z)) // a parenthesized list of three tokens
MY_MACRO(x y) // two tokens
MY_MACRO(x y z) // three tokens
MY_MACRO(x = y) // three tokens with the second one being something specific
 
Are any of these possible?
 
Thanks,
Nate.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net