Re: Question on shared memory concurrency

2024-03-04 Thread Andy Valencia via Digitalmars-d-learn
On Monday, 4 March 2024 at 03:42:48 UTC, Richard (Rikki) Andrew Cattermole wrote: A way to do this without spawning threads manually: ... Thank you! Of course, a thread dispatch per atomic increment is going to be s.l.o.w., so not surprising you had to trim the iterations. Bug I still hope

Re: Question on shared memory concurrency

2024-03-04 Thread evilrat via Digitalmars-d-learn
On Monday, 4 March 2024 at 16:02:50 UTC, Andy Valencia wrote: On Monday, 4 March 2024 at 03:42:48 UTC, Richard (Rikki) Andrew Cattermole wrote: A way to do this without spawning threads manually: ... Thank you! Of course, a thread dispatch per atomic increment is going to be s.l.o.w., so not

Re: Question on shared memory concurrency

2024-03-04 Thread Andy Valencia via Digitalmars-d-learn
On Monday, 4 March 2024 at 16:02:50 UTC, Andy Valencia wrote: On Monday, 4 March 2024 at 03:42:48 UTC, Richard (Rikki) Andrew Cattermole wrote: ... I still hope to be able to share memory between spawned threads, and if it isn't a shared ref of a shared variable, then what would it be? Do I ha

Testing membership in associative array

2024-03-04 Thread Lettever via Digitalmars-d-learn
I am trying to create a function that tests membership in nested associative array, however the function I create below, only accepts keys of the same type and if given keys of different types it does not compile, help would be appreciated. This is a example of what Im talking about. ```d impor

Re: Need help with Windows linkage ( DMD using ImportC)

2024-03-04 Thread Carl Sturtivant via Digitalmars-d-learn
On Monday, 4 March 2024 at 21:21:20 UTC, Carl Sturtivant wrote: ``` blah.obj: error LNK2019: unresolved external symbol _mul128 referenced in function MultiplyExtract128 blah.obj: error LNK2019: unresolved external symbol __shiftright128 referenced in function MultiplyExtract128 blah.obj: error

Re: Testing membership in associative array

2024-03-04 Thread Profunctor via Digitalmars-d-learn
On Monday, 4 March 2024 at 23:49:46 UTC, Lettever wrote: [ ... ] ```d // A template constraint is added to ensure we may always index into `keys`, // in addition to being a sanity check. bool contains(M, K...)(M map, K keys) if (K.length > 0) { static if (K.length == 1) return (keys[0]

Re: Testing membership in associative array

2024-03-04 Thread Profunctor via Digitalmars-d-learn
My sincerest apologies, my initial solution is flawed due to a foolish oversight. The below version works. ```d bool contains(M, K...)(M map, K keys) if (K.length > 0) { static if (K.length == 1) return (keys[0] in map) !is null; else return (keys[0] in map) !is null && contains(map[