Re: Gneric linkedList range adaptor

2023-02-12 Thread Ben Jones via Digitalmars-d-learn
On Saturday, 11 February 2023 at 05:02:49 UTC, Steven Schveighoffer wrote: Reported https://issues.dlang.org/show_bug.cgi?id=23687 Assuming this is a compiler bug and it gets fixed, does this seem like something worth trying to add to std.range?

Re: Gneric linkedList range adaptor

2023-02-10 Thread Paul Backus via Digitalmars-d-learn
On Friday, 10 February 2023 at 22:10:20 UTC, Ben Jones wrote: I'm trying to write a range adaptor for linked list types. The range type seems to work OK, but my helper function to deduce the node type has a compiler error. My hunch is that `nextField` loses its association with T when I'm try

Re: Gneric linkedList range adaptor

2023-02-10 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/10/23 5:10 PM, Ben Jones wrote: I'm trying to write a range adaptor for linked list types.  The range type seems to work OK, but my helper function to deduce the node type has a compiler error.  My hunch is that `nextField` loses its association with T when I'm trying to pass it as a templ

Re: Gneric linkedList range adaptor

2023-02-10 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 10 February 2023 at 23:39:11 UTC, Ruby The Roobster wrote: The problem is that Node.next is not, and cannot be `static`. Thus, there is no way for you to pass it as an alias template parameter, and this should be considered a compiler bug that this doesn't error out. Nevermind

Re: Gneric linkedList range adaptor

2023-02-10 Thread Ali Çehreli via Digitalmars-d-learn
On 2/10/23 14:10, Ben Jones wrote: > Any idea how to fix the helper method? I came up with the following solution: > struct LinkedListAdaptor(alias nextField, T){ In this case nextField will be a callable (a lambda below). > void popFront() { > current = __traits(child, current,

Re: Gneric linkedList range adaptor

2023-02-10 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 10 February 2023 at 22:10:20 UTC, Ben Jones wrote: I'm trying to write a range adaptor for linked list types. The range type seems to work OK, but my helper function to deduce the node type has a compiler error. My hunch is that `nextField` loses its association with T when I'm try

Gneric linkedList range adaptor

2023-02-10 Thread Ben Jones via Digitalmars-d-learn
I'm trying to write a range adaptor for linked list types. The range type seems to work OK, but my helper function to deduce the node type has a compiler error. My hunch is that `nextField` loses its association with T when I'm trying to pass it as a template parameter inside the helper metho