ENH: add identity(IntRange) and Istream operator for common types

- provides consistency with identity(label, label) and looks more
  familiar than using labelRange::labels()

- relocates labelRange IO operators to IntRange

ENH: make sliceRange interators random access

STYLE: scalarRanges::match() instead of predicate operator
This commit is contained in:
Mark Olesen
2020-09-28 17:13:19 +02:00
parent 27e71c2d9e
commit 56c9134ccc
10 changed files with 487 additions and 142 deletions

View File

@ -20,6 +20,7 @@ Description
#include "argList.H"
#include "labelPair.H"
#include "IntRange.H"
#include "StringStream.H"
using namespace Foam;
@ -66,12 +67,22 @@ int main(int argc, char *argv[])
typedef IntRange<int> intRange;
Info<< "Default construct int(32): " << IntRange<int32_t>() << nl
<< "Default construct int(64): " << IntRange<int64_t>() << nl;
Info<< "Default construct int32_t: " << IntRange<int32_t>() << nl
<< "Default construct int64_t: " << IntRange<int64_t>() << nl;
Info<< " one: " << intRange(10) << nl
<< " two: " << intRange(5, 10) << nl;
// Read from stream
{
IStringStream is("(10 100)");
intRange range;
is >> range;
Info<< "From stream int32_t: " << range << nl;
}
for
(
const labelPair& pr