Avatar
omochimetaru 1/26/2020 3:37 PM
はい。
3:40 PM
struct|class|enum SimpleVariadic<T: variadic P1> { } extension SimpleVariadic { var someTs: T { /* ... */ } func testCollection() -> (T...) { // All your `map`, `filter`, etc are here! let arr1: [String] = someTs.map { "\($0)" } let arr2: [P1] = someTs.filter { $0 is Int } let first: P1? = someTs.first return (someTs...) } }
3:40 PM
こんな感じになってますね。
3:41 PM
#ifempty じゃなくて (variadic型).first みたいな。