In this talk I will demonstrate the steps I have taken to learn the new C++20 ranges library, how taking advantage of this library has required a mental shift in the way I write code.
We will explore what the ranges library has to offer by stepping through some basic problems to solve, gradually changing from an imperative style to something more declarative. We will look at the relationship with functional programming, and the merits and demerits of adopting this style in C++ today.
What I hope you will take away from this talk is...
- What is a `range`
- What is a `view`
- What is the relationship between `container`, `iterator`, `range`, and `view`
- How to write a basic `view`
- An introduction to the ranges library and how to use it
- How the ranges library can improve code readability, testability, and thread safety
- Examples, resources, and tips, to help you adopt the ranges library
- An overview of some of the difficulties you might face adopting the ranges library today