function template
std::real
<complex>
template<class T> T real (const complex<T>& x);
Return real part of complex
Returns the
real part of the complex number
x.
The function simply calls
x's member function
real.
Parameters
- x
- Complex value.
Return value
Real part of
x.
T is
x's
complex template type (i.e., its value type).
Example
1 2 3 4 5 6 7 8 9 10 11 12 13
|
// complex::real example
#include <iostream>
#include <complex>
using namespace std;
int main ()
{
complex<double> mycomplex (10.0,1.0);
cout << "Real part: " << real(mycomplex) << endl;
return 0;
}
|
Output:
See also
- imag
- Return imaginary part of complex (function template)
- complex::real
- Return real part (public member function)