Last active
February 27, 2018 05:57
-
-
Save brandonvanha/f50fa1ce40132f648319e7f8390060bf to your computer and use it in GitHub Desktop.
Revisions
-
brandonvanha revised this gist
Feb 27, 2018 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,3 +2,13 @@ protocol Numeric { func *(lhs: Self, rhs: Self) -> Self } extension Double: Numeric {} extension Float: Numeric {} extension Int: Numeric {} func genericMultiplier<T: Numeric>(lhs: T, rhs: T) -> T { return lhs * rhs } genericMultiplier(lhs: 5, rhs: 6) genericMultiplier(lhs: 18.2 rhs: 19.5) -
brandonvanha created this gist
Feb 27, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ protocol Numeric { func *(lhs: Self, rhs: Self) -> Self }