View source code
Display the source code in std/datetime/date.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Enum member std.datetime.date.isTimePoint

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

enum isTimePoint(T) = hasMin && hasMax && hasOverloadedOpBinaryWithDuration && hasOverloadedOpAssignWithDuration && hasOverloadedOpBinaryWithSelf && !is(U == Duration);

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 Duration and returns Unqual!T.

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

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

Example

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));

Authors

Jonathan M Davis

License

Boost License 1.0.