So I can pass by reference, and store that reference in a structure or class, and if I make changes elsewhere and check that reference again where I stored it the changes will be there because I'm just accessing the same memory.
Is there a library that will let me do something like this:
int foo = 9;
int bar = 5;
// obviously other arithmetic would exist too, and could be combined
Equation foo_minus_bar = Subtract(foo, bar);
// output: 4
cout << foo_minus_bar << endl;
foo = 11;
// output: 6
cout << foo_minus_bar << endl;
It would also be nice if I could access the inputs (preferably as a flat array or similar, but beggars can't be choosers, and maybe even something like this:
// literal character for character output: foo - bar
cout << foo_minus_bar.formula() << endl;
I could make one myself, but I'd rather not reinvent the wheel if it exists.