std::valarray::sum
Da cppreference.com
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
T sum() const; |
||
Calcula a soma dos 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.
A função pode ser usada somente se operator+= é definido para
T
tipo. Se o std::valarray
está vazio, o comportamento é indefinido. A ordem em que os elementos são processados por esta função não é 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.
Índice |
[editar] Parâmetros
(Nenhum)
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
A soma dos 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] Exemplo
#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'; }
Saída:
55
[editar] Veja também
applies a function to every element of a valarray (função pública membro) | |
resume uma série 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. (modelo de função) |