Understanding Ranges Views and View Adaptors Objects in C++20/C++23 -- Bartlomiej Filipek
In this article, we’d shed some light on the implementation of ranges::reverse_view and std::views::reverse. We’ll compare them to understand the differences between views and their adaptor objects.
Understanding Ranges Views and View Adaptors Objects in C++20/C++23
By Bartlomiej Filipek
From the article:
Let’s look at an example to understand how these views work. Assume we have a rangerof integers from 1 to 5. When we applystd::views::reversetor, it creates a view representing the elements ofrin the reverse order.
#include <ranges> #include <vector> #include <iostream> int main() { std::vector<int> r = {1, 2, 3, 4, 5}; auto reversed = r | std::views::reverse; for (auto i : reversed) std::cout << i << " "; // same as: for (auto i : r | std::views::reverse) std::cout << i << " "; }

In C++, perfect forwarding is the act of passing a function’s parameters to another function while preserving its reference category. It is commonly used by wrapper methods that want to pass their parameters through to another function, often a constructor.
In this article, we are going to review two new features of C++23. Now the language allows the call operator (
The Curiously Recurring Template Pattern (CRTP) is a heavily used idiom in C++. It is similarly resistant to understanding as the classic design pattern visitor I presented in my last post: “
Some time ago I started working on P1705 Enumerating Core Undefined Behavior, I have collected a large set of undefined behavior (UB) during that time. There is going to be a lot of work involved in getting the annex into shape and editing it into the standard. While this work is ongoing, I will take some time to write blog posts to explore the set of undefined behaviors.
Anyone who thinks a small C++ standard follows a significant C++ standard is wrong. C++23 provides powerful extensions to C++20. These extensions include the core language, particularly the standard library. Today, I present a small but very impactful feature of the core language: deducing this.
In the 2023 Annual C++ Developer Survey conducted by the C++ Foundation, the community identified a number of major pain points when working with C++.