Skip to content

Instantly share code, notes, and snippets.

@glass5er
Created June 19, 2013 07:11
Show Gist options
  • Save glass5er/5812226 to your computer and use it in GitHub Desktop.
Save glass5er/5812226 to your computer and use it in GitHub Desktop.
to stringize arguments in macro, just prepend '#'
#include <iostream>
#include <string>
using namespace std;
//-- to stringize arguments in macro, just prepend '#'
#define SET_STR(name,x) string name(#name); cout << name << " = " << x << endl;
int main(int argc, char const* argv[])
{
SET_STR(hoge,0);
SET_STR(fuga,550.5);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment