std::complex::real - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::complex::real

From cppreference.com
< cpp‎ | numeric‎ | complex

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

Accesses the real part of the complex number.

1) Returns the real part.
2) Sets the real part to `value`.

### [edit] Parameters

value | - | the value to set the real part to

### [edit] Return value

1) The real part.
2) (none)

### [edit] See also

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

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/numeric/complex/real&oldid=71599"