In C++, is it possible to make a multi-statement macro with nested if statements inside of it like the one below? I\'ve be
If you're using C++ you should avoid using macros altogether. They are not type-safe, they're not namespace-aware, they're hard to debug and just they're plain messy.
If you need a type-independent function, use templates:
template
bool match_symbol(T symbol, T token) {
if(something == symbol){
if( symbol == '-'){
}else if (symbol != '-'){
}
...
or if the parameters can be different types:
template
bool match_symbol(T symbol, V token) {
if(something == symbol){
if( symbol == '-'){
}else if (symbol != '-'){
}
...