The Wayback Machine - https://web.archive.org/web/20170926020838/http://ja.cppreference.com/w/cpp/numeric/valarray/sum
名前空間
変種
操作

std::valarray::sum

提供: cppreference.com
< cpp‎ | numeric‎ | valarray

 
 
ニューメリックスライブラリ
一般的な数学関数
浮動小数点環境
複素数
数値配列
擬似乱数生成
コンパイル時有理数演算(C++11)
汎用の数値演算
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
 
 
T sum()const;
要素の和を計算.
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.
関数はoperator+=がタイプT定義されている場合にのみ使用することができます。 std::valarrayが空の場合、動作は未定義です。要素は、この関数によって処理される順序は不定である.
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.

目次

[編集]パラメータ

(なし)

[編集]値を返します

要素の和.
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.

[編集]

#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';}

出力:

55

[編集]参照

applies a function to every element of a valarray
(パブリックメンバ関数)[edit]
要素の範囲をまとめている
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.

(関数テンプレート)[edit]
close