Namespaces
Variants
Views
Actions

std::get(std::complex)

From cppreference.com
< cpp‎ | numeric‎ | complex
 
 
 
 
Defined in header <complex>
template< std::size_t I >
friend constexpr T& get( std::complex<T>& x );
(1) (since C++26)
template< std::size_t I >
friend constexpr const T& get( const std::complex<T>& x );
(2) (since C++26)
template< std::size_t I >
friend constexpr T&& get( std::complex<T>&& x );
(3) (since C++26)
template< std::size_t I >
friend constexpr const T&& get( const std::complex<T>&& x );
(4) (since C++26)

Returns the reference to real or imaginary part from a complex when I == 0 or I == 1, respectively. It is mainly provided for structured binding support.

Contents

[edit] Parameters

x - a complex

[edit] Return value

1-4) A reference to the real or imaginary part from the stored one when I == 0 or I == 1, respectively.

[edit] Example

[edit] See also

Structured binding (C++17) binds the specified names to sub-objects or tuple elements of the initializer[edit]
tuple accesses specified element
(function template) [edit]
accesses an element of a pair
(function template) [edit]
accesses an element of an array
(function template) [edit]