Namensräume
Varianten

std::valarray::sum

Aus cppreference.com
< cpp‎ | numeric‎ | valarray

 
 
Numerik-Bibliothek
Gemeinsame mathematischen Funktionen
Floating-Point-Umgebung
Komplexe Zahlen
Numerische Arrays
Pseudo-Zufallszahlen
Compile-time rationale Arithmetik(C++11)
Generische numerische Operationen
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
 
 
T sum()const;
Berechnet die Summe der Elemente .
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.
Die Funktion kann nur verwendet werden, wenn operator+= für Typ T definiert werden. Wenn die std::valarray leer ist, ist das Verhalten undefiniert. Die Reihenfolge, in der die Elemente von dieser Funktion verarbeitet werden, ist nicht angegeben .
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.

Inhaltsverzeichnis

[Bearbeiten]Parameter

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

[Bearbeiten]Rückgabewert

Die Summe der Elemente .
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.

[Bearbeiten]Beispiel

#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';}

Output:

55

[Bearbeiten]Siehe auch

applies a function to every element of a valarray
(öffentliche Elementfunktion)[edit]
fasst eine Reihe von Elementen
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.

(Funktions-Template)[edit]
close