Extending base types to conform to custom protocols
Now, we want to be able to use any of the integer types as types in our
ImmutableVector3D<T> classes. We want to make the two classes capable of working with elements of any integer type supported in Swift, that is, any of the following types, in addition to the floating point types that the classes already support:
It seems to be a pretty simple task. We would just have to replace the generic type constraint in each class declaration from
FloatingPoint to a more generic protocol. We need a protocol to which all the previously enumerated types conform to, and to which the floating point types also conform. However, we will ...