From 3f53022733d0102c0ab612eb5fa8d3f13fa47168 Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 1 Jun 2017 12:32:50 +0000 Subject: [PATCH] .tutorial git-svn-id: svn://ultimatepp.org/upp/trunk@11128 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- tutorial/CoreTutorial/CoreTutorial.upp | 1 - tutorial/CoreTutorial/Range.cpp | 6 ------ tutorial/CoreTutorial/Ranges.cpp | 14 ++++++++++++++ 3 files changed, 14 insertions(+), 7 deletions(-) delete mode 100644 tutorial/CoreTutorial/Range.cpp diff --git a/tutorial/CoreTutorial/CoreTutorial.upp b/tutorial/CoreTutorial/CoreTutorial.upp index ae9964e33..e2214db92 100644 --- a/tutorial/CoreTutorial/CoreTutorial.upp +++ b/tutorial/CoreTutorial/CoreTutorial.upp @@ -7,7 +7,6 @@ file Tutorial.cpp, Core readonly separator, ToDo.cpp, - Range.cpp, Logging.cpp, String.cpp, StringBuffer.cpp, diff --git a/tutorial/CoreTutorial/Range.cpp b/tutorial/CoreTutorial/Range.cpp deleted file mode 100644 index 898e9f5a2..000000000 --- a/tutorial/CoreTutorial/Range.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "Tutorial.h" - -void Ranges() -{ - -} diff --git a/tutorial/CoreTutorial/Ranges.cpp b/tutorial/CoreTutorial/Ranges.cpp index 541b5e7aa..e01c6bdc0 100644 --- a/tutorial/CoreTutorial/Ranges.cpp +++ b/tutorial/CoreTutorial/Ranges.cpp @@ -48,6 +48,12 @@ void Range() DUMP(ConstRange(1, 10)); + /// `ReverseRange` reverses the order of elements in the source range: + + Vector v{ 1, 2, 3, 4 }; + + DUMP(ReverseRange(v)); + /// `ViewRange` picks a source range and `Vector` of integer indices a provides a view of /// source range through this `Vector`: @@ -61,9 +67,17 @@ void Range() DUMP(ViewRange(x, clone(h))); DUMP(x); + /// `SortedRange` returns range sorted by predicate (default is std::less): + + DUMP(SortedRange(x)); + /// Finally `FilterRange` creates a subrange of elements satisfying certain condition: DUMP(FilterRange(x, [](int x) { return x > 3; })); + /// Various Range functions can be combined to produce complex results: + + DUMP(ReverseRange(FilterRange(x, [](int x) { return x < 4; }))); + /// }