Partager via


complex Class

The template class describes an object that stores two objects of type Type, one that represents the real part of a complex number and one that represents the imaginary part.

For a list of all members of this type, see complex Members.

template<class Type>
   class complex

Remarks

An object of class Type:

  • Has a public default constructor, destructor, copy constructor, and assignment operator with conventional behavior.

  • Can be assigned integer or floating-point values, or type cast to such values with conventional behavior.

  • Defines the arithmetic operators and math functions, as needed, that are defined for the floating-point types with conventional behavior.

In particular, no subtle differences may exist between copy construction and default construction followed by assignment. None of the operations on objects of class Type may throw exceptions.

Explicit specializations of template class complex exist for the three floating-point types. In this implementation, a value of any other type Type is typecast to double for actual calculations, with the double result assigned back to the stored object of type Type.

Requirements

Header: <complex>

Namespace: std

See Also

Concepts

complex Members

<complex> Members

Thread Safety in the Standard C++ Library