Hello,

I have my own DateTime struct.
It has opCmp() and opBinary(), I can do arithmetic with this custom DateTime and the amazing time units of the **quantities** package.

Now I'm about mo make iterations in a DateTime range:

    const
      st = DateTime(UTC, "22.1.1 8:30").utcDayStart,
en = DateTime(UTC, "22.3.5 19:56").max(now).utcDayStart + (100.0/64)*nano(second);

    //this works
    for(auto d = cast()st; d < en; d += day) writeln(d);

    //this would be nicer, but not works
    iota(st, en, day).each!writeln;

My question is, is there a way to 'extend' the functionality of the std.iota() function or it is better to come up with a unique name for this special 'iota' functionality?

I know that if I'm going to patch iota in my module, I have to make ALL the iota() variants plus my special iota variant visible in that module scope. Is this a good practice, or is there a better way?

Or maybe put it inside a DateTimeRange struct, and implement the std range functionality?



Reply via email to