Struct Interval

Defines an interval between two inclusive extremes on an explicitly supplied base type.

struct Interval(T) ;

Constructors

NameDescription
this
this

Fields

NameTypeDescription
high T
low T

Example

auto i1 = Interval!byte(10, 20);
auto i2 = Interval!byte(15);
assert(i1.low == 10);
assert(i1.high == 20);
assert(i2.low == 15);
assert(i2.high == 15);

Example

import epcompat.enumeration;
enum Count {One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten}
mixin withEnum!Count;
auto i1 = Interval!Count(Three, Six);
auto i2 = Interval!Count(Eight, Ten);
assert(i1.low == Three);
assert(i1.high == Six);
assert(i2.low == Eight);
assert(i2.high == Ten);