Espaços nominais
Variantes
Acções

std::valarray::sum

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

 
 
Biblioteca numéricos
Funções matemáticas comuns
De ponto flutuante ambiente
Números complexos
Matrizes numéricas
Pseudo-aleatório de geração de números
Tempo de compilação aritmética racional (C++11)
Genéricos operações 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.
(C++11)
 
std::valarray
Funções de membro
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.
Não-membros funções
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.
Classes auxiliares
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 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.
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.

Í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.

[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.

[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) [edit]
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) [edit]