Skip to content

Instantly share code, notes, and snippets.

@mattt
Last active August 3, 2017 21:01
Show Gist options
  • Save mattt/0576b9e4396ab5645aa9 to your computer and use it in GitHub Desktop.
Save mattt/0576b9e4396ab5645aa9 to your computer and use it in GitHub Desktop.
struct Complex<T: FloatLiteralConvertible> {
var real: T
var imaginary: T
}
func +(lhs: Complex<Double>, rhs: Complex<Double>) -> Complex<Double> {
return Complex<Double>(real: lhs.real + rhs.real, imaginary: lhs.imaginary + rhs.imaginary)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment