std:: tuple_element <std::complex>
From cppreference.net
C++
Numerics library
| Common mathematical functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Mathematical special functions (C++17) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Mathematical constants (C++20) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Basic linear algebra algorithms (C++26) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Data-parallel types (SIMD) (C++26) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Floating-point environment (C++11) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Complex numbers | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Numeric array (
valarray
)
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Pseudo-random number generation | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Bit manipulation (C++20) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Saturation arithmetic (C++26) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Factor operations | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Interpolations | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Generic numeric operations | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| C-style checked integer arithmetic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::complex
| Member functions | ||||
| Non-member functions | ||||
| Exponential functions | ||||
| Power functions | ||||
| Trigonometric functions | ||||
| Hyperbolic functions | ||||
| Helper types | ||||
|
(C++26)
|
||||
|
tuple_element
<std::complex>
(C++26)
|
||||
|
Definido en el encabezado
<complex>
|
||
|
template
<
std::
size_t
I,
class
T
>
struct tuple_element < I, std:: complex < T >> ; |
(desde C++26) | |
Las especializaciones parciales de
std::tuple_element
para
std::complex
proporcionan acceso en tiempo de compilación al tipo subyacente de número real e imaginario de un
complex
, usando sintaxis tipo tupla. Se proporcionan para soportar el enlace estructurado. El programa está mal formado si
I
>=
2
.
Contenidos |
Tipos de miembros
| Tipo de miembro | Definición |
type
|
T
|
Notas
| Macro de prueba de características | Valor | Estándar | Característica |
|---|---|---|---|
__cpp_lib_tuple_like
|
202311L
|
(C++26) | Añadir protocolo de tupla a std::complex |
Ejemplo
Ejecutar este código
#include <complex> #include <type_traits> static_assert([z = std::complex<float>()] { using T = decltype(z); return #if __cpp_lib_tuple_like >= 202311L std::is_same_v<std::tuple_element_t<0, T>, float> && std::is_same_v<std::tuple_element_t<1, T>, float> && #endif std::is_same_v<T::value_type, float>; }()); int main() {}
Véase también
| Structured binding (C++17) | enlaza los nombres especificados a subobjetos o elementos de tupla del inicializador |
|
(C++11)
|
obtiene los tipos de elemento de un tipo similar a tupla
(plantilla de clase) |
|
(C++26)
|
obtiene el tamaño de un
std::complex
(especialización de plantilla de clase) |
|
(C++26)
|
obtiene una referencia a la parte real o imaginaria de un
std::complex
(plantilla de función) |