Recently, I came across a post advocating the use of std::vector and standard algorithms.
The core message was simple: basic C++ should reflect modern C++, not "C with classes".
I welcome posts about modernizing C++ code.
However, the proposed modernization stopped at C++11.
Considering that before C++11 we effectively had one real standard dating back to 1998, I would not call this "modernization" in any meaningful sense. It is more a request to use C++ instead of C or to stop calling C code compiled with a C++ compiler "real C++".
This would sound more precise, IMO, but this is still not a modernization.
The example itself was a didactic problem: summing two arrays of different sizes, solved via explicit loops and iteration over collections.
Suggested solution: index loop over collections.
Modern C++ ranges offer a much cleaner approach. They allow expressing the transformation directly, without introducing extra functions.
The beauty of ranges is their non-owning nature & lazy evaluation: results are generated on demand, saving resources, and can be easily materialized back into owning containers when needed.
Modernization means moving forward.
Ranges are one of the biggest milestones in the algorithmic evolution of C++.
I encourage learning & using them.
Keep code concise, express intent clearly, and avoid extra algorithm scaffolding just because you are used to C++11/14.

Top comments (0)