Returning value based on argument size : Is there a way in C++ to generate code (at compile time) which looks a bit like:

T Func(T t){
if (sizeof(t) == 2){
    return X(t);
}
Else if( size of(t) == 4){
    return Y(t);
}
}

(Where T is either int32 or int16)

So at run-time i can call:

Func(_myInt)

And the code will just compile down to either X(_myInt) or Y(_myInt).

