One more thing about the code :

T inv(T m)() {
        return 1.0 / m;
}

What if we call inv(5)?
This is an error, why?

- Function explicitly states that the parameter is a floating point type.
- Operations between floating point types and integers result a floating point type , as you see from the return type, code returns the type of parameter, in this case an integer.

Thanks.

Reply via email to