Skip to content

Instantly share code, notes, and snippets.

@mattfysh
Created Feb 1, 2020
Embed
What would you like to do?
Runtime symbols
#include <iostream>
using namespace std;
template<typename T>
T make_symbol(T value, string metadata);
template<typename T>
string get_symbol_for(T value);
void printString(string str) {
cout << str << endl;
string metadata = get_symbol_for(str);
cout << metadata << endl;
}
int main() {
string greeting = make_symbol("hello", "xyz");
printString(greeting);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment