View source code
Display the source code in std/datetime/interval.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.

Struct std.datetime.interval.NegInfIntervalRange

A range over a NegInfInterval. It is an infinite range.

struct NegInfIntervalRange(TP)
  
if (isTimePoint!TP);

NegInfIntervalRange is only ever constructed by NegInfInterval. However, when it is constructed, it is given a function, func, which is used to generate the time points which are iterated over. func takes a time point and returns a time point of the same type. For instance, to iterate over all of the days in the interval NegInfInterval!Date, pass a function to NegInfInterval's bwdRange where that function took a Date and returned a Date which was one day earlier. That function would then be used by NegInfIntervalRange's popFront to iterate over the Dates in the interval - though obviously, since the range is infinite, use a function such as std.range.take with it rather than iterating over all of the dates.

As the interval goes to negative infinity, the range is always iterated over backwards, never forwards. func must generate a time point going in the proper direction of iteration, or a DateTimeException will be thrown. So, the time points that func generates must be earlier in time than the one passed to it. If it's either identical or later in time, then a DateTimeException will be thrown.

Also note that while normally the end of an interval is excluded from it, NegInfIntervalRange treats it as if it were included. This allows for the same behavior as with PosInfIntervalRange. This works because none of NegInfInterval's functions which care about whether end is included or excluded are ever called by NegInfIntervalRange. interval returns a normal interval, so any NegInfInterval functions which are called on it which care about whether end is included or excluded will treat end as excluded.

Properties

NameTypeDescription
front[get] TPThe first time point in the range.
func[get] TP delegate(scope const TP)The function used to generate the next time point in the range.
interval[get] NegInfInterval!TPThe interval that this range currently covers.
save[get] NegInfIntervalRangeReturns a copy of this.

Methods

NameDescription
opAssign (rhs)
popFront () Pops front from the range, using func to generate the next time point in the range.

Authors

Jonathan M Davis

License

Boost License 1.0.