[phobos] datetime review
Steve Schveighoffer
schveiguy at yahoo.com
Thu Oct 14 18:04:03 PDT 2010
----- Original Message ----
> From: Jonathan M Davis <jmdavisProg at gmx.com>
> What's really annoying is when you want to create a range which iterates over
> time points which are apart by some combination of years, months, and smaller
> units. Before, you could just give the function something like Dur.years(5) +
> Dur.months(1) + Dur.days(2) and it would produce a function which gave you a
> time point 5 years, 1 month, and 2 days after the previous one. But without
> MonthDuration or JointDuration, that becomes much more awkward. I'm still
> ironing out the best way to deal with the function signature for that.
>
If that's all it is then why can't you specify both a month term and a Duration
term to the range constructor:
// range takes a Duration, and optional Months type (wrapper for N months for
the type system).
auto r = myInterval.range(days(2), years(5) + months(1));
Yes it looks a bit awkward, but it's a very specific need, and not a very common
one (IMO).
-Steve
More information about the phobos
mailing list