macro parameter issues

lets say you have the form:
MY_MACRO(TemplateClass<x,y>)

the prepocessor sees the comma and thinks im trying to input "TemplateClass<x" and "y>" as parameters for MY_MACRO, but i just want one parameter "TemplateClass<x,y>"

how could i solve this?
Don't use a macro. Use an inline function or just a function instead.
theres no other way around it?
Macros are evil for many reasons. You should refrain from using them. An inline function is likely the superior choice in this situation.

Although... I think you can encase macro parameters in parenthesis to prevent this from occuring:

MY_MACRO( (TemplateClass<x,y>) )

Not 100% on that, but it's worth a try.

But again. Ew. Use an inline function.
Try the keyword typename, telling the compiler that TemplateClass<x,y> as a whole is a type, not anything else.

 
MY_MACRO( (typename TemplateClass<x,y>) )

Last edited on
The parens that Disch suggested is the only thing that will help. It is a preprocessing issue.
thanks
Topic archived. No new replies allowed.