T
travis.downs
Hi,
I'm trying to use a macro to create a unique temporary variable name,
such as
#define TEMP_OBJ(string) MyType obj_ <some magic here> (string);
So something like
TEMP_OBJ("foo")
would evaluate to
MyType obj_1234("foo");
Where the 1234 is needed to make it unique. Thing is, I can't find a
good way to make this unique stuff. I tried __LINE__, but I could
find a way to paste it to obj_ to make the variable name.
Any ideas? Surely there must be a common idiom for this.
Travis
I'm trying to use a macro to create a unique temporary variable name,
such as
#define TEMP_OBJ(string) MyType obj_ <some magic here> (string);
So something like
TEMP_OBJ("foo")
would evaluate to
MyType obj_1234("foo");
Where the 1234 is needed to make it unique. Thing is, I can't find a
good way to make this unique stuff. I tried __LINE__, but I could
find a way to paste it to obj_ to make the variable name.
Any ideas? Surely there must be a common idiom for this.
Travis