Skip to content

Instantly share code, notes, and snippets.

@illescasDaniel
Last active October 23, 2016 19:43
Show Gist options
  • Save illescasDaniel/9b4d14b8df45156f99cc02ef58373b7b to your computer and use it in GitHub Desktop.
Save illescasDaniel/9b4d14b8df45156f99cc02ef58373b7b to your computer and use it in GitHub Desktop.
Variables reflection [C++]
#include <iostream>
using namespace std;
#define varName(_name_) #_name_
#define varValue(_variable_) _variable_
int main() {
int test = 10;
cout << varName(test) << ' ' << varValue(test) << endl;
// Output: test 10
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment