Re: How to collect "some" items of a range in an array?

2025-01-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, January 6, 2025 1:15:23 PM MST Renato via Digitalmars-d-learn wrote: > On Monday, 6 January 2025 at 19:58:12 UTC, H. S. Teoh wrote: > > On Mon, Jan 06, 2025 at 07:30:27PM +, Renato via > > Digitalmars-d-learn wrote: > >> Is there any Phobos function that collects "some" items of a >

Re: Issue eBPF kernel programs with ldc?

2025-01-06 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 07/01/2025 12:03 AM, data pulverizer wrote: On Monday, 6 January 2025 at 07:26:02 UTC, Richard (Rikki) Andrew Cattermole wrote: On 06/01/2025 5:27 AM, data pulverizer wrote: @(ldc.attributes.section("xdp_md")) struct xdp_md { I don't understand why you gave a type declaration a section.

Re: How to collect "some" items of a range in an array?

2025-01-06 Thread Renato via Digitalmars-d-learn
On Monday, 6 January 2025 at 19:58:12 UTC, H. S. Teoh wrote: On Mon, Jan 06, 2025 at 07:30:27PM +, Renato via Digitalmars-d-learn wrote: Is there any Phobos function that collects "some" items of a range into an array/slice? It's kind of embarrassing that I've been trying to find this for

Re: How to collect "some" items of a range in an array?

2025-01-06 Thread monkyyy via Digitalmars-d-learn
On Monday, 6 January 2025 at 19:30:27 UTC, Renato wrote: Is there any Phobos function that collects "some" items of a range into an array/slice? It's kind of embarrassing that I've been trying to find this for hours now without success :(. I think I know how to write this myself (though writin

Re: How to collect "some" items of a range in an array?

2025-01-06 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jan 06, 2025 at 07:30:27PM +, Renato via Digitalmars-d-learn wrote: > Is there any Phobos function that collects "some" items of a range > into an array/slice? > It's kind of embarrassing that I've been trying to find this for hours > now without success :(. [...] > My use case is to pa

How to collect "some" items of a range in an array?

2025-01-06 Thread Renato via Digitalmars-d-learn
Is there any Phobos function that collects "some" items of a range into an array/slice? It's kind of embarrassing that I've been trying to find this for hours now without success :(. I think I know how to write this myself (though writing generic stuff on ranges is not exactly straightforward)

Re: Simplify some C-style code

2025-01-06 Thread Nick Treleaven via Digitalmars-d-learn
On Saturday, 28 December 2024 at 23:23:02 UTC, monkyyy wrote: The spec would need to drastically improve before my opinion changes; Im also uninterested practicing withholding my opinions. The spec may have flaws, as any complex technical spec is prone to. There is no reason why anyone on the

Re: Simplify some C-style code

2025-01-06 Thread sfp via Digitalmars-d-learn
On Sunday, 5 January 2025 at 16:02:47 UTC, Christian Köstlin wrote: On Wednesday, 25 December 2024 at 07:49:28 UTC, sfp wrote: I have some code like this: ``` enum DomainType { Ball, Box, CsgDiff } struct Domain(int Dim) { DomainType type; union { Ball!Dim ball; Box!Dim box;

Re: Issue eBPF kernel programs with ldc?

2025-01-06 Thread data pulverizer via Digitalmars-d-learn
On Monday, 6 January 2025 at 07:26:02 UTC, Richard (Rikki) Andrew Cattermole wrote: On 06/01/2025 5:27 AM, data pulverizer wrote: @(ldc.attributes.section("xdp_md")) struct xdp_md { I don't understand why you gave a type declaration a section. Its not done on the C side. https://github.com/l