PosInfInterval.intersection

Returns the intersection of two intervals

  1. Interval!TP intersection(Interval!TP interval)
    struct PosInfInterval(TP)
    const
    intersection
    (
    scope const Interval!TP interval
    )
  2. PosInfInterval intersection(PosInfInterval interval)
  3. Interval!TP intersection(NegInfInterval!TP interval)

Parameters

interval Interval!TP

The interval to intersect with this interval.

Throws

std.datetime.date.DateTimeException if the two intervals do not intersect or if the given interval is empty.

Examples

assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection(
            Interval!Date(Date(1990, 7, 6), Date(2000, 8, 2))) ==
       Interval!Date(Date(1996, 1 , 2), Date(2000, 8, 2)));

assert(PosInfInterval!Date(Date(1996, 1, 2)).intersection(
            Interval!Date(Date(1999, 1, 12), Date(2011, 9, 17))) ==
       Interval!Date(Date(1999, 1 , 12), Date(2011, 9, 17)));

Meta