Skip to content

Commit 03eb188

Browse files
TylerMSFTTylerMSFT
authored andcommitted
draft
1 parent 3960154 commit 03eb188

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

docs/standard-library/ranges.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,30 @@ helpviewer_keywords: ["ranges header"]
99
introduction - what is a range
1010
motivations/advantages
1111
example
12-
range adaptors
12+
13+
It’s been 20 years since the STL was standardized, and all I want to do is pass a vector to sort. Is that too much to ask? Nope. With C++20, you will finally be able to do this: https://ericniebler.com/2018/12/05/standard-ranges/
14+
15+
std::vector< int > v = // ...
16+
std::ranges::sort( v ); // Hurray!
17+
18+
Pillars: https://github.com/ericniebler/range-v3
19+
Views - Views are composable adaptations of ranges where the adaptation happens lazily as the view is iterated.
20+
Actions - an action is an eager application of an algorithm to a container that mutates the container in-place and returns it for further processing.
21+
Algorithms
22+
23+
range adaptors : https://ericniebler.com/2018/12/05/standard-ranges/
1324
example
25+
Also The true power of ranges lies in the ability to create pipelines that transform ranges on the fly https://ericniebler.com/2018/12/05/standard-ranges/
26+
but these may be out of date - verify in product
1427
view adaptors
1528
https://www.fluentcpp.com/2017/01/12/ranges-stl-to-the-next-level/ (good range/view examples, composability)
1629
example
1730

31+
Views and actions use the pipe syntax (e.g., rng | adapt1 | adapt2 | ...) so your code is terse and readable from left to right.
32+
33+
Range algorithms available (casey list):
34+
https://devblogs.microsoft.com/cppblog/initial-support-for-c20-ranges/
35+
1836

1937
# `<ranges>`
2038

0 commit comments

Comments
 (0)