|
|
|
|
|
by seivan
3811 days ago
|
|
Would someone be kind to explain how the transpiler/compiler knows that
num of T1 generic(?) type can be used with the <= operator?
Or that something the user themselves have to define? Wouldn't be something like "T1 where T1 is Numeric"? Thanks! |
|
If you pass a type that cannot be used with the <= operator it will error in compile time.
Being able to do this is part of why C++ templates are much more powerful than Java/C# generics and why they enable a different (and alternative) form of polymorphism to inheritance and explicit interfaces.