[ Web Proxy ]
URL:
Viewing: https://fr.cppreference.com/cpp/numeric/valarray/sum [Back]  [Original]

std::valarray::sum cppreference.com
cppreference.com
Espaces de noms
Variantes

std::valarray::sum

De cppreference.com

<metanoindex/>

 
 
Bibliothque Numerics
Fonctions mathmatiques courantes
Virgule flottante environnement
Nombres complexes
Tableaux numriques
La gnration de nombres pseudo-alatoires
Moment de la compilation arithmtique rationnelle (C++11)
Gnriques des oprations numriques
Original:
Generic numeric operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iota (C++11)
accumulate
inner_product
adjacent_difference
partial_sum
 
 
<tbody> </tbody>
T sum() const;
Calcule la somme des lments .
Original:
Computes the sum of the elements.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
La fonction peut tre utilise uniquement si operator+= est dfini pour T type. Si le std::valarray est vide, le comportement est indfini. L'ordre dans lequel les lments sont traits par cette fonction n'est pas spcifi .
Original:
The function can be used only if operator+= is defined for type T. If the std::valarray is empty, the behavior is undefined. The order in which the elements are processed by this function is unspecified.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Paramtres

(Aucun)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Retourne la valeur

La somme des lments .
Original:
The sum of the elements.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Exemple

#include <iostream>
#include <valarray>

int main()
{
    std::valarray<int> a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    std::cout << a.sum() << '\n';
}

Rsultat :

55

Voir aussi

applies a function to every element of a valarray
(fonction membre publique) [edit]
rsume un ensemble d'lments
Original:
sums up a range of elements
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction gnrique) [edit]

Web Proxy Viewer  |  New URL  |  Original Page