< cpp‎ | numeric
Revision as of 15:14, 30 April 2013 by Cubbi (Talk | contribs)

Template:ddcl list begin <tr class="t-dsc-header">

Defined in header <complex>

<td></td> <td></td> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
template< class T >
class complex; //not defined

<td > (1) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
template<> class complex<float>;

<td > (2) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
template<> class complex<double>;

<td > (3) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
template<> class complex<long double>;

<td > (4) </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end

The specializations std::complex<float>, std::complex<double>, and std::complex<long double> are literal types for representing and manipulating complex numbers.

The effect of instantiating the template complex for any other type is unspecified.


Member types

Member type Definition
value_type T

Member functions

Template:cpp/numeric/complex/dcl list operator=Template:cpp/numeric/complex/dcl list realTemplate:cpp/numeric/complex/dcl list imagTemplate:cpp/numeric/complex/dcl list operator arith
constructs a complex number
(public member function)

Non-member functions

Template:cpp/numeric/complex/dcl list operator arith2Template:cpp/numeric/complex/dcl list operator arith3Template:cpp/numeric/complex/dcl list operator cmpTemplate:cpp/numeric/complex/dcl list operator ltltgtgtTemplate:cpp/numeric/complex/dcl list real2Template:cpp/numeric/complex/dcl list imag2Template:cpp/numeric/complex/dcl list absTemplate:cpp/numeric/complex/dcl list argTemplate:cpp/numeric/complex/dcl list normTemplate:cpp/numeric/complex/dcl list conjTemplate:cpp/numeric/complex/dcl list projTemplate:cpp/numeric/complex/dcl list polarTemplate:cpp/numeric/complex/dcl list expTemplate:cpp/numeric/complex/dcl list logTemplate:cpp/numeric/complex/dcl list log10Template:cpp/numeric/complex/dcl list powTemplate:cpp/numeric/complex/dcl list sqrtTemplate:cpp/numeric/complex/dcl list sinTemplate:cpp/numeric/complex/dcl list cosTemplate:cpp/numeric/complex/dcl list tanTemplate:cpp/numeric/complex/dcl list asinTemplate:cpp/numeric/complex/dcl list acosTemplate:cpp/numeric/complex/dcl list atanTemplate:cpp/numeric/complex/dcl list sinhTemplate:cpp/numeric/complex/dcl list coshTemplate:cpp/numeric/complex/dcl list tanhTemplate:cpp/numeric/complex/dcl list asinhTemplate:cpp/numeric/complex/dcl list acoshTemplate:cpp/numeric/complex/dcl list atanh
Exponential functions
Power functions
Trigonometric functions
Hyperbolic functions

Non-static data members

For any complex number z, reinterpret_cast<T(&)[2]>(z)[0] is the real part of z and reinterpret_cast<T(&)[2]>(z)[1] is the imaginary part of z.

For any pointer to an element of an array of complex numbers p and any valid array index i, reinterpret_cast<T*>(p)[2*i] is the real part of the complex number p[i], and reinterpret_cast<T*>(p)[2*i + 1] is the imaginary part of the complex number p[i]

These requirements essentially limit implementation of each of the three specializations of std::complex to declaring two and only two non-static data members, of type value_type, with the same member access, which hold the real and the imaginary components, respectively.