Some interesting points concerning correctness and efficiency there.
I guess one of the problems I have is it can be hard to reason about correctness and efficiency of standard library algorithms, since it's not clear how they are implemented, or what guarantees or assumptions they provide. It often becomes a matter of looking up some documentation, and hoping they address the particular concern. Though the documentation is usually quite thorough, and the algorithms are usually quite good about both efficiency and correctness, so that's good.
I noticed the second article was quite dated. The publication year is 2001. I noticed this after they started talking about functors, and how the examples lacked any use of lambdas. Lambdas are functors. That's how they are implemented. Lambdas are just syntactic sugar to generate anonymous functors. Their use would have simplified some of those code examples. It probably would have also made them easier to read, module having to understand the lambda syntax.
I think people probably should use lambdas more often. They can be pretty awesome. It does make code a little harder to read for less experienced C++ programmers though.
In terms of going forward, I expect Ranges will change things quite drastically. Using the Ranges library, it should be possible to write (largely) loop free code, much like how
std::unique_ptr and
std::shared_ptr allow you to write
new/
delete free code. I recently watched a talk that showed a console printing calendar app written using Ranges that demonstrated that quite nicely:
CppCon 2015: Eric Niebler "Ranges for the Standard Library"It seems C++ is really (finally) starting to gain ground with expressing high level concerns in a simple manner. I'm liking where the future is heading.
On a somewhat related note, I watched another interesting talk about some of the costs of higher level abstractions:
CppCon 2019: Chandler Carruth “There Are No Zero-cost Abstractions”