From 70d38c50cd95ad25bbdd5ecc5dfebee3481dacd9 Mon Sep 17 00:00:00 2001 From: Luca Formaggia Date: Fri, 25 Oct 2024 21:00:17 +0200 Subject: [PATCH] Update README.md --- Examples/src/STL/RangesAndViews/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Examples/src/STL/RangesAndViews/README.md b/Examples/src/STL/RangesAndViews/README.md index 878e8e02..19afb822 100644 --- a/Examples/src/STL/RangesAndViews/README.md +++ b/Examples/src/STL/RangesAndViews/README.md @@ -91,7 +91,7 @@ Yet, they can still work with an iterator-sentinel pair if needed, offering flex ``` - **Projections**: Projections allow for more sophisticated operations by transforming elements before processing them in the algorithm. - The are implemented as an additional and optional argument. + They are implemented as an additional and optional argument. ```cpp // Traditional algorithm to sort by absolute values @@ -104,9 +104,10 @@ Yet, they can still work with an iterator-sentinel pair if needed, offering flex Projection can also be adopted to specify the element used in the algorithm. For instance, in the following example, we sort a vector of pairs by the second element of the pair: ```cpp - std::vector> v = {{1, 2}, {2, 1}, {3, 3}}; + std::vector> v = { {1, 2}, {2, 1}, {3, 3} }; std::ranges::sort(v, {}, [](auto p) { return p.second; }); ``` + - **Pointer-to-Member Callables**: These algorithms support pointer-to-member callables, which can specify operations on member variables of class objects within a range. An example: ```cpp