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

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

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 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: 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

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