Create a gist now

Instantly share code, notes, and snippets.

@mattt /Complex.swift
Last active Aug 29, 2015

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