How to define a polymorphic function for numeric values
Hi,
Sorry for this question if it's too basic but I'm just a C programmer starting with C++, I want to define this polymorphic function __max3 to work for all the different types of numeric values.
Like the built in function __max:
Code:
type __max(
type a,
type b
);
This is what my old C code for this was (now I want to do it a bit more clean with the function):
Code:
#define __max3(x1,x2,x3) __max(x1,max(x2,x3))
I've tried this but doesn't work:
Code:
type __max3(type a, type b, type c)
{
return ( __max(a,max(b,c)) );
}
On another note, if I later want to make this function to be inlined with __forceinline, will it still work with the polymorphic definition?
TIA & Regards ...