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, nextField);
I changed that to
current = nextField(current);
> auto rng1 = LinkedListAdaptor!(Node.next, Node*)(head);
Commented that out.
> auto rng = linkedListAdaptor!(Node.next)(head);
Replaced that with
auto rng = linkedListAdaptor!(node => node.next)(head);
Now it works but explicitly creating a lambda feels less than ideal.
Perhaps it can be improved.
Ali