The OpenD Programming Language

isTimePoint

Whether the given type defines all of the necessary functions for it to function as a time point.

1. T must define a static property named min which is the smallest value of T as Unqual!T.

2. T must define a static property named max which is the largest value of T as Unqual!T.

3. T must define an opBinary for addition and subtraction that accepts core.time.Duration and returns Unqual!T.

4. T must define an opOpAssign for addition and subtraction that accepts core.time.Duration and returns ref Unqual!T.

5. T must define a opBinary for subtraction which accepts T and returns core.time.Duration.

Examples

import core.time : Duration;
import std.datetime.interval : Interval;
import std.datetime.systime : SysTime;

static assert(isTimePoint!Date);
static assert(isTimePoint!DateTime);
static assert(isTimePoint!SysTime);
static assert(isTimePoint!TimeOfDay);

static assert(!isTimePoint!int);
static assert(!isTimePoint!Duration);
static assert(!isTimePoint!(Interval!SysTime));

Meta