Suppose that there are types of “temperature” (T) and “distance” (D). Both can indeed be declared as regular typedefs:
typedef int T;
typedef int D;
But if I need overloaded functions:
void f(T) {}
void f(D) {}
it will not work because both types are identical.
What is the most advanced C ++ way to implement such an overload?
Clearly, for these types should be distinguishable to the compiler.
source
share