为什么“accumulate”没有进入 C++20 的范围?

Why didn't `accumulate` make it into Ranges for C++20?

我怀疑 accumulate 不是唯一没有成功的算法。

也许现在有更好的方法在一个范围内执行累加(折叠),因此 accumulate 已过时?

不,accumulate 是一个非常合理的算法,它不会被任何其他算法淘汰。它不被包含在 c++20 中的原因只是时间问题。人们认为最好在范围方面添加尽可能多的内容,而不必担心一次添加 everything。否则,受约束算法中的 none 可能会进入 c++20,这将是一种耻辱。

还有一些算法还没有约束,还有整个<numeric><memory> headers.

幸运的是,有一个 proposal 可以添加这些剩余的算法(我很乐观地认为这些将被添加到 c++23 中)。其实这个提案的介绍很好的回答了你的问题:

“Every time someone asks why we didn’t cover <numeric> and <memory> algorithms: We thought 187 pages of TS was enough.” — Casey Carter