std::valarray::sum
De cppreference.com
![]() | Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate. La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
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.
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.
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.
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.
You can help to correct and verify the translation. Click here for instructions.
[editar]Ejemplo
Ejecuta este código
#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';}
Salida:
55
[editar]Ver también
applies a function to every element of a valarray (función miembro pública) | |
Suma un rango de elementos (plantilla de función) |