.tutorial

git-svn-id: svn://ultimatepp.org/upp/trunk@11128 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2017-06-01 12:32:50 +00:00
parent cd87ad9d52
commit 3f53022733
3 changed files with 14 additions and 7 deletions

View file

@ -7,7 +7,6 @@ file
Tutorial.cpp,
Core readonly separator,
ToDo.cpp,
Range.cpp,
Logging.cpp,
String.cpp,
StringBuffer.cpp,

View file

@ -1,6 +0,0 @@
#include "Tutorial.h"
void Ranges()
{
}

View file

@ -48,6 +48,12 @@ void Range()
DUMP(ConstRange(1, 10));
/// `ReverseRange` reverses the order of elements in the source range:
Vector<int> 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; })));
///
}