# std::complex< _Tp > Struct Template Reference
[Complex Numbers]

List of all members.

## Public Types

- typedef _Tp value_type

## Public Member Functions

- const complex & __rep () const
- template<typename _Up > complex (const complex< _Up > &__z)
- complex (const _Tp &__r=_Tp(), const _Tp &__i=_Tp())
- void imag (_Tp __val)
- _Tp imag () const
- template<typename _Up > complex< _Tp > & operator*= (const complex< _Up > &)
- complex< _Tp > & operator*= (const _Tp &)
- template<typename _Up > complex< _Tp > & operator+= (const complex< _Up > &)
- complex< _Tp > & operator+= (const _Tp &__t)
- template<typename _Up > complex< _Tp > & operator-= (const complex< _Up > &)
- complex< _Tp > & operator-= (const _Tp &__t)
- template<typename _Up > complex< _Tp > & operator/= (const complex< _Up > &)
- complex< _Tp > & operator/= (const _Tp &)
- template<typename _Up > complex< _Tp > & operator= (const complex< _Up > &)
- complex< _Tp > & operator= (const _Tp &)
- void real (_Tp __val)
- _Tp real () const

## Detailed Description

### template<typename _Tp>
struct std::complex< _Tp >

Template to represent complex numbers.

Specializations for float, double, and long double are part of the library. Results with any other type are not guaranteed.

Parameters:

  | Tp | Type of real and imaginary values.

Definition at line 122 of file complex.

## Member Typedef Documentation

template<typename _Tp>

typedef _Tp std::complex< _Tp >::value_type

Value typedef.

Definition at line 125 of file complex.

## Constructor & Destructor Documentation

template<typename _Tp>

std::complex< _Tp >::complex | ( | const _Tp & | __r = `_Tp()`,
|  | const _Tp & | __i = `_Tp()` |
| ) |  |  | `[inline]`

Default constructor. First parameter is x, second parameter is y. Unspecified parameters default to 0.

Definition at line 129 of file complex.

template<typename _Tp>
template<typename _Up >

std::complex< _Tp >::complex | ( | const complex< _Up > & | __z | ) | `[inline]`

Copy constructor.

Definition at line 136 of file complex.

## Member Function Documentation

template<typename _Tp>

complex<_Tp>& std::complex< _Tp >::operator+= | ( | const _Tp & | __t | ) | `[inline]`

Add t to this complex number.

Definition at line 179 of file complex.

template<typename _Tp>

complex<_Tp>& std::complex< _Tp >::operator-= | ( | const _Tp & | __t | ) | `[inline]`

Subtract t from this complex number.

Definition at line 188 of file complex.

The documentation for this struct was generated from the following file:

- complex