Swift Generics Error When Enforcing Protocol Conformance...
Swift Generics Error When Enforcing Protocol Conformance...
- Subject: Swift Generics Error When Enforcing Protocol Conformance...
- From: "Peters, Brandon" <email@hidden>
- Date: Thu, 24 Dec 2015 06:08:05 +0000
- Thread-topic: Swift Generics Error When Enforcing Protocol Conformance...
All,
I have two function signatures for the following:
func linconv<T: FloatingPointType>(signal_A signal_A: [T], signal_B: [T]) -> [T]? {
var arr = [T](count: 4, repeatedValue: 0.0)
return nil
}
func linconv<T: IntegerType>(signal_A signal_A: [T], signal_B: [T]) -> [T]? {
var arr = [T](count: 4, repeatedValue: 0)
return nil
}
An error is called on the array initialization in the first case but not the second. The error message reads "Cannot invoke initializer for type '[T]' with an argument list of type '(count: Int, repeatedValue: Double)’”. Has anyone seen this? Is it a bug? It makes sense to me (so far anyway) that both should compile.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden