On Thursday, 12 May 2022 at 20:12:19 UTC, Ali Çehreli wrote:
And I've been thinking 'iota' may not be as suitable as I
thought at first. I like the following even more:
auto r0 = st
.by(Duration(2))
.take(5);
So I wrote this by() for my DateTime and then:
import
On Thursday, 12 May 2022 at 17:06:39 UTC, Ali Çehreli wrote:
I don't care whether it is good practice or not. :) The
following is what you meant anyway and seems to work.
I restricted the parameter types to the ones I wanted to use.
And for the standard iota behavior I used a public import.
On 5/12/22 12:51, ag0aep6g wrote:
>> auto iota(B, E, S)(B begin, E end, S step)
> [...]
>> {
>> static struct Result
>> {
>> B current;
> [...]
>> void popFront()
>> {
> [...]
>> current += step;
>> }
>> }
> [...]
>> }
>
> Mark iota's `begin
On Thursday, 12 May 2022 at 16:57:35 UTC, H. S. Teoh wrote:
Does your DateTime type support the `++` operator?
It can't because I only want to use the quantities.si.Time type
to do arithmetic with my DateTime. In my previous DateTime, it
was a lot of problem that I was doing math on it's raw
On Thursday, 12 May 2022 at 17:06:39 UTC, Ali Çehreli wrote:
void main() {
const st = DateTime(Duration(0));
[...]
// (0) I think D should not insist on 'const'
// when copying types that have no indirections.
// We shouldn't need the cast() below in this case.
[...]
iota(cast()st,
On 5/12/22 04:57, realhet wrote:
> //this would be nicer, but not works
> iota(st, en, day).each!writeln;
For others, the problem is, iota does have a version that works with
user types but not one that parameterizes 'step'. An oversight?
> My question is, is there a way to 'extend' t
On Thu, May 12, 2022 at 11:57:54AM +, realhet via Digitalmars-d-learn wrote:
[...]
> 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
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,