Avatar
Collection ならこんな感じですね。 extension Collection { @inlinable public func indices( where predicate: (Element) throws -> Bool ) rethrows -> [Index] { return try indices.filter { try predicate(self[$0]) } } }