累算Cの関数を合計++ STL()
1.1説明と機能のプロトタイプ
accumulate(_InIt _First, _InIt _Last, _Ty _Val)
_First
そして、_Last
蓄積期間、_Val
蓄積した初期値。
戻り値の型_Val
と同じ。
1.2 int型のアプリケーション
そして、出力配列
vector<int> testArray = { 1, 2, 3, 4 };
int sumT = accumulate(testArray.begin(), testArray.end(), 0);
アプリケーションで1.2文字列
char型は文字列型スプライシングです
vector<char> testChr = { 'l', 'h', 'k' };
string strSum = accumulate(testChr.begin(), testChr.end(), (string)" "); \\sunT = "lhk"