mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 06:05:58 -06:00
.tutorial
git-svn-id: svn://ultimatepp.org/upp/trunk@11128 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
cd87ad9d52
commit
3f53022733
3 changed files with 14 additions and 7 deletions
|
|
@ -7,7 +7,6 @@ file
|
|||
Tutorial.cpp,
|
||||
Core readonly separator,
|
||||
ToDo.cpp,
|
||||
Range.cpp,
|
||||
Logging.cpp,
|
||||
String.cpp,
|
||||
StringBuffer.cpp,
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
#include "Tutorial.h"
|
||||
|
||||
void Ranges()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -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; })));
|
||||
|
||||
///
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue