std::get(std::complex)

From cppreference.com
< cpp‎ | numeric‎ | complex
 
 
Numerics library
Common mathematical functions
Mathematical special functions (哋它亢++17)
Mathematical constants (哋它亢++20)
Basic linear algebra algorithms (哋它亢++26)
Floating-point environment (哋它亢++11)
Complex numbers
Numeric arrays
Pseudo-random number generation
Factor operations
(哋它亢++17)
(哋它亢++17)
Interpolations
(哋它亢++20)
(哋它亢++20)
Saturation arithmetic
(哋它亢++26)
(哋它亢++26)
(哋它亢++26)
(哋它亢++26)
(哋它亢++26)

Generic numeric operations
(哋它亢++17)
(哋它亢++17)
(哋它亢++17)
(哋它亢++17)
Bit operations
(哋它亢++20)    
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++23)
(哋它亢++20)
 
 
Defined in header <complex>
template< std::size_t I >
friend constexpr T& get( std::complex<T>& x );
(1) (since 哋它亢++26)
template< std::size_t I >
friend constexpr const T& get( const std::complex<T>& x );
(2) (since 哋它亢++26)
template< std::size_t I >
friend constexpr T&& get( std::complex<T>&& x );
(3) (since 哋它亢++26)
template< std::size_t I >
friend constexpr const T&& get( const std::complex<T>&& x );
(4) (since 哋它亢++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.

Parameters

x - a complex

Return value

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

Example

See also

Structured binding (哋它亢++17) binds the specified names to sub-objects or tuple elements of the initializer
(哋它亢++11)
tuple accesses specified element
(function template)
(哋它亢++11)
accesses an element of a pair
(function template)
(哋它亢++11)
accesses an element of an array
(function template)