vibe.d community/forum/whatever ?

2021-08-29 Thread someone via Digitalmars-d-learn
https://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/ I've been reading vibe.d tour and some documentation today to get some first impressions. https://vibed.org/community pointed to the link above ... but it seems it is full of crap.

Interpolate dates

2021-08-29 Thread Booster via Digitalmars-d-learn
I have some dates and date-times. I need to interpolate the date-times from the dates. I guess the easy way to do this would be to convert the date and date-times to long usecs and then use that to interpolate? Does D have anything that can do this easily? To be clear, I have list of dates

Re: template parameters

2021-08-29 Thread Ali Çehreli via Digitalmars-d-learn
On 8/29/21 3:31 PM, Charles Hixson wrote: > Thanks. I going to have to study: > > enum supportsCall = isIntegral!(typeof(T.init.%s())); > > > for awhile to make any sense of that, but it looks like just what I was > looking for. Trying to explain with comments: // This is an eponymous template

Re: template parameters

2021-08-29 Thread Charles Hixson via Digitalmars-d-learn
Thanks.  I going to have to study: enum supportsCall = isIntegral!(typeof(T.init.%s())); for awhile to make any sense of that, but it looks like just what I was looking for. On 8/29/21 2:41 PM, Ali Çehreli via Digitalmars-d-learn wrote: On 8/29/21 11:32 AM, Charles H. wrote: I've set up

Re: template parameters

2021-08-29 Thread Ali Çehreli via Digitalmars-d-learn
On 8/29/21 11:32 AM, Charles H. wrote: I've set up a class template (so far untested) thus:     class    AARL (T, ndx = "ndx")     if (isIntegral(T.init.ndx) )     If I'm correct, this should work for ndx an integer variable of T, but I'd really like T to be able to be anything

template parameters

2021-08-29 Thread Charles Hixson via Digitalmars-d-learn
I've set up a class template (so far untested) thus: class    AARL (T, ndx = "ndx")         if (isIntegral(T.init.ndx) ) If I'm correct, this should work for ndx an integer variable of T, but I'd really like T to be able to be anything which can be stored both in an array and in an associative

template parameters

2021-08-29 Thread Charles H. via Digitalmars-d-learn
I've set up a class template (so far untested) thus: classAARL (T, ndx = "ndx") if (isIntegral(T.init.ndx) ) If I'm correct, this should work for ndx an integer variable of T, but I'd really like T to be able to be anything which can be stored both in an array and in

Re: byte + byte = int: why?

2021-08-29 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 29 August 2021 at 16:21:40 UTC, jfondren wrote: ... after Phobos is patched. ``` error: undefined identifier ‘Lhs’, did you mean alias ‘Rhs’? ``` Shows how much anyone actually uses this code, I guess--the bug was introduced [in 2017][1], and as far as I can tell has never even

Re: byte + byte = int: why?

2021-08-29 Thread jfondren via Digitalmars-d-learn
On Sunday, 29 August 2021 at 15:57:18 UTC, Paul Backus wrote: On Sunday, 29 August 2021 at 15:42:18 UTC, Ali Çehreli wrote: Depending on the situation, you may want to use std.conv.to, which does a value range check and throws an exception to prevent an error: byte foo(byte a, byte b) {

Re: byte + byte = int: why?

2021-08-29 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 29 August 2021 at 15:42:18 UTC, Ali Çehreli wrote: Depending on the situation, you may want to use std.conv.to, which does a value range check and throws an exception to prevent an error: byte foo(byte a, byte b) { import std.conv : to; return (a + b).to!byte; }

Re: byte + byte = int: why?

2021-08-29 Thread Ali Çehreli via Digitalmars-d-learn
On 1/18/19 9:09 AM, Mek101 wrote: > source/hash.d(11,25): Error: cannot implicitly convert expression > `cast(int)temp[fowardI] + cast(int)temp[backwardI]` of type `int` to `byte` Others suggested casting as a solution which works but it will hide potential errors. Depending on the

Re: byte + byte = int: why?

2021-08-29 Thread Ali Çehreli via Digitalmars-d-learn
On 8/29/21 3:57 AM, Rekel wrote: On Friday, 18 January 2019 at 18:49:23 UTC, Steven Schveighoffer wrote: As others have said, those are the rules D has for historical reasons, you just have to deal with them. Is that to ensure compatibility with C? Yes. It's mentioned multiple times in

Error load: QtE5Widgets64.dll

2021-08-29 Thread frame via Digitalmars-d-learn
I'm Following the instruction by evilrat, https://forum.dlang.org/post/xljvxkqimdvvbvujc...@forum.dlang.org but apparently I'm to stupid to run the example. The application quits with `Error load: QtE5Widgets64.dll` which is located next to the EXE-file (also Qt5Core.dll, Qt5Gui.dll and

Re: Is it legal to remove a key from associative array while iterating over aa.keys if a foreach loop?

2021-08-29 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 29 August 2021 at 11:09:28 UTC, Steven Schveighoffer wrote: This is exactly the opposite! Sorry about that. I can't believe I mixed those up.

Re: Is it legal to remove a key from associative array while iterating over aa.keys if a foreach loop?

2021-08-29 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/29/21 5:02 AM, Mike Parker wrote: On Sunday, 29 August 2021 at 08:55:44 UTC, realhet wrote: Is it safe, or do I have to take a snapsot of the keys range like this? -> You shouldn't remove anything when iterating over `.keys` or `.values`. Use `.byKey` and `.byValue` instead to get

Re: byte + byte = int: why?

2021-08-29 Thread Rekel via Digitalmars-d-learn
On Friday, 18 January 2019 at 18:49:23 UTC, Steven Schveighoffer wrote: As others have said, those are the rules D has for historical reasons, you just have to deal with them. Is that to ensure compatibility with C?

Re: Is it legal to remove a key from associative array while iterating over aa.keys if a foreach loop?

2021-08-29 Thread realhet via Digitalmars-d-learn
On Sunday, 29 August 2021 at 09:02:52 UTC, Mike Parker wrote: On Sunday, 29 August 2021 at 08:55:44 UTC, realhet wrote: Is it safe, or do I have to take a snapsot of the keys range like this? -> You shouldn't remove anything when iterating over `.keys` or `.values`. Use `.byKey` and

Re: Is it legal to remove a key from associative array while iterating over aa.keys if a foreach loop?

2021-08-29 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 29 August 2021 at 08:55:44 UTC, realhet wrote: Is it safe, or do I have to take a snapsot of the keys range like this? -> You shouldn't remove anything when iterating over `.keys` or `.values`. Use `.byKey` and `.byValue` instead to get ranges that are independent of the aa.

Is it legal to remove a key from associative array while iterating over aa.keys if a foreach loop?

2021-08-29 Thread realhet via Digitalmars-d-learn
Hi, //remap the result blobs foreach(k; res.blobs.keys){ int p = map(k); if(p!=k){ res.blobs[p].weight += res.blobs[k].weight; res.blobs.remove(k); } } It boils down to: foreach(k; aa.keys) aa.remove(k); Is it safe, or do I have to take a snapsot of the keys