For internal use only.
This base defines all the basic operations of complex numbers. The primary template uses an array to store the real and imaginary parts, while a partial specialization uses C99 complex numbers (if available) for the same.
T | The element value type. | |
Enable | If void, enables a particular specialization |
Public Types | |
typedef T | data_type [2] |
The data type, usually an array. In the partial specialization, it is the C99 complex number. | |
Public Member Functions | |
T | imag () const |
Gets the complex part. | |
T | real () const |
Gets the real part. | |
Friends | |
Binary Logic | |
You can also use a value of type T for either lhs or rhs. | |
bool | operator && (const complex< T > &lhs, const complex< T > &rhs) |
Tests whether both lhs and rhs are non-zero. | |
bool | operator!= (const complex< T > &lhs, const complex< T > &rhs) |
Tests whether lhs is not equal to rhs. | |
bool | operator== (const complex< T > &lhs, const complex< T > &rhs) |
Tests whether lhs is equal to rhs. | |
bool | operator|| (const complex< T > &lhs, const complex< T > &rhs) |
Tests whether either lhs or rhs are non-zero. | |
Binary Arithmetic | |
You can also use a value of type T for either lhs or rhs. | |
const complex< T > | operator * (const complex< T > &lhs, const complex< T > &rhs) |
Multiplies lhs by rhs. | |
const complex< T > | operator+ (const complex< T > &lhs, const complex< T > &rhs) |
Adds lhs to rhs. | |
const complex< T > | operator- (const complex< T > &lhs, const complex< T > &rhs) |
Subtracts lhs to rhs. | |
const complex< T > | operator/ (const complex< T > &lhs, const complex< T > &rhs) |
Divides lhs by rhs. | |
Unary Logic | |
bool | operator! (const complex< T > &z) |
Tests whether lhs is zero. | |
Unary Arithmetic | |
const complex< T > | operator+ (const complex< T > &lhs) |
Copies lhs. | |
const complex< T > | operator- (const complex< T > &lhs) |
Negates lhs. |