Instantly share code, notes, and snippets.

Embed
What would you like to do?
Templates e geração de código
class NonTemplated {
int value;
public:
using value_type = int;
NonTemplated(int a) : value(a) {}
int sum(int a) { return value + a; }
};
template <typename T>
class Templated {
T value;
public:
using value_type = T;
Templated(T a) : value(a) {}
T sum(T a) { return value + a; }
};
//.....
NonTemplated nt{1};
Templated<int> ti{1};
Templated<double> td{1.0};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment