Scroll to navigation

std::complex::imag(3) C++ Standard Libary std::complex::imag(3)

NAME

std::complex::imag - std::complex::imag

Synopsis


primary template
complex<T>
T imag() const; (until
C++14)
constexpr T (since
imag() const; C++14)
void imag( T (until
value ); C++20)
constexpr void (since
imag( T value ); C++20)
specialization
complex<float>
float imag() (until
const; C++11)
constexpr float (since
imag() const; C++11)
void imag( float (until
value ); C++20)
constexpr void (since
imag( float C++20)
value );
specialization
complex<double>
double imag() (1) (until
const; C++11)
constexpr double (2) (since
imag() const; C++11)
void imag( (until
double value ); (1) C++20)
constexpr void (since
imag( double (2) C++20)
value );
specialization
complex<long (1)
double>
long double (2) (until
imag() const; C++11)
constexpr long (since
double imag() C++11)
const; (1)
void imag( long (until
double value ); C++20)
constexpr void (2) (since
imag( long C++20)
double value );


Accesses the imaginary part of the complex number.


1) Returns the imaginary part.
2) Sets the imaginary part to value.

Parameters


value - the value to set the imaginary part to

Return value


1) The imaginary part of *this.
2) (none)

Notes


In C++11, overload (1) in complex specializations used to be specified without const
qualifier. However, in C++11, a constexpr specifier used in a non-static member
function implies const, and thus the behavior is as if const is specified.

See also


imag returns the imaginary component
(function template)
real accesses the real part of the complex number
(public member function)

2022.07.31 http://cppreference.com