Posts

Showing posts from March, 2021

Overview of C++20: Ranges

Image
Posts in "Overview of C++20" Ranges Concepts TBA: ... 📌 Disclaimers : The idea of this overview is self-education. The main goal - keep it simple and short. ❗ There is no guarantee that below theoretical and practical parts are correkt and up-to-date 😉 Introduction Looking back at the advantages of the iterator pattern - easy, robust, efficient, flexible. It is better than directly manipulating the underlying data structures, but still not as elegant as you would like it to be. How often have you written begin and end by now? Probably not enough yet to be fed up with it, but enough to get the point - it is needlessly tedious. And that is where C++20's ranges come in. #include <algorithm> #include <iostream> #include <vector> #include <range/v3/action/sort.hpp> #include <range/v3/algorithm/copy.hpp> #include <range/v3/view/all.hpp> i