Espacios de nombres
Variantes
Acciones

std::valarray::sum

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

 
 
Numéricos biblioteca
Funciones matemáticas comunes
Floating-point medio ambiente
Los números complejos
Matrices numéricas
Pseudo-aleatoria de generación de números
En tiempo de compilación aritmética racional (C++11)
Genéricos operaciones numéricas
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
Las funciones miembro
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.
Terceros funciones
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.
Clases de ayuda
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;
Calcula la suma de los elementos .
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 función puede utilizarse únicamente si operator+= se define para T tipo. Si el std::valarray está vacío, el comportamiento es indefinido. El orden en que los elementos son procesados ​​por esta función no está especificado .
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.

Contenido

[editar] Parámetros

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

[editar] Valor de retorno

La suma de los elementos .
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.

[editar] Ejemplo

#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

[editar] Ver también

applies a function to every element of a valarray
(miembro público función) [edit]
resume una serie de elementos
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.

(función de plantilla) [edit]