[stdlib] Add lazy and Array filter algorithm

This came up during API review

Swift SVN r18364
This commit is contained in:
Dave Abrahams
2014-05-18 22:24:43 +00:00
parent 41439be708
commit 8537f014bf
5 changed files with 203 additions and 0 deletions

View File

@@ -232,6 +232,12 @@ extension ${Self} : ArrayType {
return result
}
/// Return a ${Self} containg the elements `x` of `self` for which
/// `includeElement(x)` is `true`
func filter(includeElement: (T)->Bool) -> ${Self} {
return ${Self}(Swift.filter(self, includeElement))
}
}
extension ${Self} : Reflectable {