accumulate

accumulateって関数の適用順序が仕様で定まっているから別にmonoidじゃなくても使えたのね.普通に考えたらmonoidに限定した実装をわざわざする必要はないんだけれど.まぁ,monoid以外にaccumulate使って(゜д゜)ウマーな例なんて自分には思いつかないんだけどw.

The function object binary_op is not required to be either commutative or associative: the order of all of accumulate's operations is specified. The result is first initialized to init. Then, for each iterator i in [first, last), in order from beginning to end, it is updated by result = result + *i (in the first version) or result = binary_op(result, *i) (in the second version).

#っていうか閉じてる2項関数で,上に書かれている操作をやりたいなら何でも使えるっちゅーことだよな.具体的に何があるかは到底思いつかないけれどw.