I have a macro in a function that instantiates a variable of a given type (and does a couple of other things that are not relevant).
Essentially MACRO(foo, f)
expands to foo f;
But if foo
is say a std::map<int, int>
then the expansion fails due to the extra comma.
I work around this by writing typedef std::map<int, int> bar;
followed by MACRO(bar, b)
.
I'm concerned though that I'm leaking typedef
s into the program source which may cause me problems in the future.
So, how long do typedef
s last for?