Re: dirEntries removes entire branches of empty directories

2022-11-10 Thread Ali Çehreli via Digitalmars-d-learn
On 11/9/22 11:30, Vladimir Panteleev wrote: > On Wednesday, 9 November 2022 at 19:05:58 UTC, Ali Çehreli wrote: >> Running the program shows no output; 'a' is not visited as a directory >> entry. > > That's not what happens for me: Does not happen for me today either. (?) I must have confused mys

difference between x.atomicOp!"+="(1) and atomicFetchAdd(x, 1)?

2022-11-10 Thread mw via Digitalmars-d-learn
Hi, Anyone can help explain what is the difference between x.atomicOp!"+="(1) and atomicFetchAdd(x, 1)? From the doc, their return values are different atomicOp Performs the binary operation 'op' on val using 'mod' as the modifier. Returns: The result of the operation. atomicFetchAdd Atom

Re: difference between x.atomicOp!"+="(1) and atomicFetchAdd(x, 1)?

2022-11-10 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 10 November 2022 at 17:04:31 UTC, mw wrote: Hi, Anyone can help explain what is the difference between x.atomicOp!"+="(1) and atomicFetchAdd(x, 1)? Looking at the source in druntime, `atomicOp!"+="` forwards to `atomicFetchAdd` internally, so they should have the same behavior.

Re: difference between x.atomicOp!"+="(1) and atomicFetchAdd(x, 1)?

2022-11-10 Thread mw via Digitalmars-d-learn
On Thursday, 10 November 2022 at 18:30:16 UTC, Paul Backus wrote: On Thursday, 10 November 2022 at 17:04:31 UTC, mw wrote: Hi, Anyone can help explain what is the difference between x.atomicOp!"+="(1) and atomicFetchAdd(x, 1)? Looking at the source in druntime, `atomicOp!"+="` forwards to `

Re: dirEntries removes entire branches of empty directories

2022-11-10 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 10 November 2022 at 16:34:53 UTC, Ali Çehreli wrote: On 11/9/22 11:30, Vladimir Panteleev wrote: > On Wednesday, 9 November 2022 at 19:05:58 UTC, Ali Çehreli wrote: >> Running the program shows no output; 'a' is not visited as a directory >> entry. > > That's not what happens for me:

Re: dirEntries removes entire branches of empty directories

2022-11-10 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Nov 10, 2022 at 07:07:33PM +, Imperatorn via Digitalmars-d-learn wrote: > On Thursday, 10 November 2022 at 16:34:53 UTC, Ali Çehreli wrote: > > On 11/9/22 11:30, Vladimir Panteleev wrote: > > > On Wednesday, 9 November 2022 at 19:05:58 UTC, Ali Çehreli > > > wrote: > > >> Running the p

Re: dirEntries removes entire branches of empty directories

2022-11-10 Thread Ali Çehreli via Digitalmars-d-learn
On 11/9/22 12:06, Ali Çehreli wrote: > I am using its sibling 'ftw' Now that we know that dirEntries works properly, I decided not to use ftw. However, ftw performs about twice as fast as dirEntries (despite some common code in the implementation below). I am leaving it here in case somebody

aa.keys, synchronized and shared

2022-11-10 Thread torhu via Digitalmars-d-learn
I'm trying to make a more thread-safe wrapper for AA's: ``` synchronized final class SyncAA(K, V) /// { /// V opIndex(K key) { return data_[key]; } /// V opIndexAssign(V value, K key) { return data_[key] = value; } /// K[] keys() const { return data_.keys; } ///

Removing an element from an array

2022-11-10 Thread Alexander Zhirov via Digitalmars-d-learn
I have an array of self-written class `A`. I'm sorry for my tactlessness, but I'm confused about the modules. How do I correctly find a specific object `fragment` inside the array and delete it? I don't quite understand which modules to use to do this optimally. ```d A[] arr; A fragment = new

Re: Removing an element from an array

2022-11-10 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Nov 10, 2022 at 11:26:45PM +, Alexander Zhirov via Digitalmars-d-learn wrote: > I have an array of self-written class `A`. I'm sorry for my tactlessness, > but I'm confused about the modules. How do I correctly find a specific > object `fragment` inside the array and delete it? I don't

Re: Removing an element from an array

2022-11-10 Thread Alexander Zhirov via Digitalmars-d-learn
On Thursday, 10 November 2022 at 23:36:29 UTC, H. S. Teoh wrote: On Thu, Nov 10, 2022 at 11:26:45PM +, Alexander Zhirov via Digitalmars-d-learn wrote: I have an array of self-written class `A`. I'm sorry for my tactlessness, but I'm confused about the modules. How do I correctly find a spec

Re: aa.keys, synchronized and shared

2022-11-10 Thread torhu via Digitalmars-d-learn
On Thursday, 10 November 2022 at 21:55:26 UTC, torhu wrote: I'm trying to make a more thread-safe wrapper for AA's: ``` synchronized final class SyncAA(K, V) /// I chose to fix this by just using `synchronized (this)` inside each method instead, for now. Still interested in cleaner solutions

ImportC linking issue

2022-11-10 Thread confuzzled via Digitalmars-d-learn
Wondering if someone can help me with this. Mr. Adam D. Ruppe got me 90% there, but I'm a little lost after reaching the 99% mark. I want to use XLSX I/O to manipulate excel spreadsheets. I've cloned, built, and installed the library. And with the help of Adam, I am now able to import it and l

Re: aa.keys, synchronized and shared

2022-11-10 Thread cc via Digitalmars-d-learn
On Friday, 11 November 2022 at 01:09:54 UTC, torhu wrote: On Thursday, 10 November 2022 at 21:55:26 UTC, torhu wrote: I'm trying to make a more thread-safe wrapper for AA's: ``` synchronized final class SyncAA(K, V) /// I chose to fix this by just using `synchronized (this)` inside each meth

Re: Removing an element from an array

2022-11-10 Thread Alexander Zhirov via Digitalmars-d-learn
On Friday, 11 November 2022 at 00:02:09 UTC, Alexander Zhirov wrote: ```d import std.algorithm; arr = arr.remove(arr.countUntil(fragment)); ``` And will this method work? ```d A[] arr; A fragment = new A; ... remove(current => current == fragment)(arr); ```

Re: Removing an element from an array

2022-11-10 Thread Alexander Zhirov via Digitalmars-d-learn
On Friday, 11 November 2022 at 05:36:37 UTC, Alexander Zhirov wrote: On Friday, 11 November 2022 at 00:02:09 UTC, Alexander Zhirov wrote: ```d import std.algorithm; arr = arr.remove(arr.countUntil(fragment)); ``` And will this method work? ```d A[] arr; A fragment = new A; ... remove(current