ultimatepp/upptst/Range2/Range2.cpp
cxl 0e1a0ce9d6 .upptst
git-svn-id: svn://ultimatepp.org/upp/trunk@11683 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2018-01-11 08:41:04 +00:00

28 lines
724 B
C++

#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
DUMP(MakeIota(10));
DUMP(MakeIota(10, 1, 3));
// Testing r-value argument
Sort(SubRange(MakeIota(10), 1, 4));
Sort(ReverseRange(MakeIota(10)));
Sort(ViewRange(MakeIota(10), MakeIota(3)));
Sort(FilterRange(MakeIota(10), [=](int x) { return x > 4; }));
Sort(SortedRange(MakeIota(10)));
// Testing const argument
auto h = MakeIota(20);
const auto& x = h;
DUMP(SubRange(x, 1, 4));
DUMP(SortedRange(x));
DUMP(ReverseRange(x));
DUMP(ViewRange(x, MakeIota(3)));
DUMP(FilterRange(x, [=](int x) { return x > 4; }));
DUMP(SortedRange(x));
DUMP(FilterRange(ReverseRange(SortedRange(x)), [] (int x) { return x & 1; }));
}