I came across this template of C++
template <typename T> int sgn(T val) {
return (T(0) < val) - (val < T(0));
}
And I have to admit I don't really get it. If I try to do a numeric application, let's say -1: (0<(-1))-(-1 < 0) => False - True I get a subtraction of Bool. Is that how it should work? Can someone explain the different steps the compiler will do?