std::numeric

std::iota

コンテナの中に連続する要素を詰める

std::iota(hoge.begin(), hoge.end(), 1);

すると1始まりのintがendまで詰められる

事前に所望の要素数にコンテナをresizeしておく必要がある

std::accumulate

関数型で言うreduce

std::accumulate(InputIterator, InputIterator, BinaryOperator)

二項演算子を取る関数なら任意で使える

BinaryOperator binary_op(init, value) {
    return init + value;
    // return init * value;
    // return init / value;
}

これは

init = binary_op(init, value)

という形で再帰的に計算されるということ

std::partial_sum

accumulateの途中部分を得る

std::partial_sum(v1.begin(), v1.end(), output.begin(), func = operator+());

std::adjacent_difference

隣接和 0, 1-0, 2-1, 3-2, ...