deduction guides for
std::valarray
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::valarray
| Member functions | ||||
| Non-member functions | ||||
| Helper classes | ||||
| Deduction guides (C++17) | ||||
|
Défini dans l'en-tête
<valarray>
|
||
|
template
<
typename
T,
std::
size_t
cnt
>
valarray ( const T ( & ) [ cnt ] , std:: size_t ) - > valarray < T > ; |
(depuis C++17) | |
Ce guide de déduction est fourni pour std::valarray afin de permettre la déduction à partir d'un tableau et de sa taille (notez que la déduction à partir d'un pointeur et d'une taille est couverte par les guides implicites).
Exemple
Exécuter ce code
#include <iostream> #include <valarray> int main() { int a[] = {1, 2, 3, 4}; std::valarray va(a, 3); // utilise le guide de déduction explicite for (int x : va) std::cout << x << ' '; std::cout << '\n'; }
Sortie :
1 2 3