Get the latest tech news
Stepanov's biggest blunder? The curious case of adjacent difference
How STL algorithms parallel the fundamental theorem of calculus.
The few times I needed to compute pairwise differences, the semantics of std::adjacent_difference stood in the way, and I ended up writing a custom loop. I disagree with Stepanov’s design choice, but I’m glad it made me question his intentions and find these hidden connections. This design preserves symmetry with partial sums but avoids the type mismatch between the input and output sequences, achieving both elegance and pragmatism.
Or read this on Hacker News