Namespace
Varianti

std::valarray::sum

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

 
 
Numeri libreria
Comuni funzioni matematiche
Virgola mobile ambiente
I numeri complessi
Array numerici
Pseudo-casuale generazione
In fase di compilazione aritmetica razionale (C++11)
Generici operazioni numeriche
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
 
std::valarray
Membri funzioni
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Non membri funzioni
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Helper classi
Original:
Helper classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
T sum() const;
Calcola la somma degli elementi.
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 funzione può essere utilizzata solo se operator+= è definito per T tipo. Se il std::valarray è vuoto, il comportamento è indefinito. L'ordine in cui vengono elaborati gli elementi da questa funzione non è specificato.
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.

Indice

[modifica] Parametri

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

[modifica] Valore di ritorno

La somma degli elementi.
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.

[modifica] Esempio

#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

[modifica] Vedi anche

applies a function to every element of a valarray
(membro pubblico funzione) [edit]
riassume una serie di elementi
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.

(funzione di modello) [edit]