Re: ImportC linking issue

2022-11-11 Thread confuzzled via Digitalmars-d-learn
On Friday, 11 November 2022 at 03:15:17 UTC, confuzzled wrote: When I try to compile it, I get a slew of errors about undefined symbols. It wasn't finding libexpat and libminizip so I copied those to my work directory and tried again. With that, most of the errors disappeared. The remaining one

Re: Hipreme's #5 Tip of the day - Avoid raw pointers at all cost

2022-11-11 Thread zjh via Digitalmars-d-learn
On Friday, 11 November 2022 at 13:05:19 UTC, Hipreme wrote: ... Nice article,thank you.

Re: aa.keys, synchronized and shared

2022-11-11 Thread torhu via Digitalmars-d-learn
On Friday, 11 November 2022 at 14:19:31 UTC, Kagamin wrote: Try this: ``` private: V[K] sharedTable; ref inout(V[K]) unsharedTable() inout { return *cast(inout(V[K])*)&sharedTable; } ``` Thanks, that worked! Feels like programming in C, though.

Re: dirEntries removes entire branches of empty directories

2022-11-11 Thread Ali Çehreli via Digitalmars-d-learn
On 11/11/22 08:00, Ali Çehreli wrote: > It may have to do something with the performance of the hard disk. I meant "the reason you got a much better improvement" may have to do something with the performance differences of your hard disk and mine. Ali

Re: dirEntries removes entire branches of empty directories

2022-11-11 Thread Ali Çehreli via Digitalmars-d-learn
On 11/11/22 05:13, kdevel wrote: > dmd -O compiled patched (see below!) version applied to /usr/bin on my > desktop > yields: > > ftw : 363 ms, 750 ÎŒs, and 5 [*] > dirEntries: 18 secs, 831 ms, 738 ÎŒs, and 3 [*] Great. I did not use -O with my test. It may have to do something with the p

Re: aa.keys, synchronized and shared

2022-11-11 Thread Kagamin via Digitalmars-d-learn
With allocation: ``` synchronized final class SyncAA(K, V) { V opIndex(K key) { return sharedTable[key]; } V opIndexAssign(V value, K key) { return sharedTable[key]=value; } const(K[]) keys() const { return unsharedTable.keys; } void remove(K key) { sharedTable.remove(ke

Re: aa.keys, synchronized and shared

2022-11-11 Thread Kagamin via Digitalmars-d-learn
Try this: ``` synchronized final class SyncAA(K, V) { V opIndex(K key) { return sharedTable[key]; } V opIndexAssign(V value, K key) { return sharedTable[key]=value; } const(K[]) keys() const { return unsharedTable.keys; } void remove(K key) { sharedTable.remove(key); }

Re: dirEntries removes entire branches of empty directories

2022-11-11 Thread kdevel via Digitalmars-d-learn
On Thursday, 10 November 2022 at 21:27:28 UTC, Ali Çehreli wrote: 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

Hipreme's #5 Tip of the day - Avoid raw pointers at all cost

2022-11-11 Thread Hipreme via Digitalmars-d-learn
Attention, C and C++ programmers are more likely to use what I'm going to talk about. If you're a C++ programmer, you're probably thinking about shared/unique pointers. But that's not what this is about. Take the `void*` type. This type can be pretty much anything, this is "okay" if you want

Re: Removing an element from an array

2022-11-11 Thread ag0aep6g via Digitalmars-d-learn
On Friday, 11 November 2022 at 06:10:33 UTC, Alexander Zhirov wrote: 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 th