Last active
August 29, 2015 14:02
-
-
Save zwaldowski/35d79c7bcd4f126e222a to your computer and use it in GitHub Desktop.
This file contains 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 characters
import Swift | |
@assignment func -=<T, U where T: ArrayType, U: Sequence, T.GeneratorType.Element: Equatable, T.GeneratorType.Element == U.GeneratorType.Element>(inout lhs: T, rhs: U) { | |
for removingItem in rhs { | |
for (index, item) in enumerate(lhs) { | |
if removingItem == item { | |
lhs.removeAtIndex(index) | |
} | |
} | |
} | |
} | |
var arr1 = [ "one", "two", "three" ] | |
var arr2 = [ "two", "three" ] | |
arr1 -= arr2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment