Formatted , ``` import std.stdio; void main(){ struct List { struct Node { float f; Node *next; } Node * root=null; bool empty() const {return !root;} void popFront() {root=root.next;} float front() const {return root.f;} void push(float f) { Node * newnode=new Node(); newnode.f=f; root.next=newnode; // Segmentation fault } } List * l=new List(); l.push(3); foreach(element;l){ // Invalid foreach aggregate writeln(element.root.f); } } ```
Re: Iteratable single linked list of floats.
Alain De Vos via Digitalmars-d-learn Wed, 21 Apr 2021 06:20:54 -0700
- Iteratable single linked list of floa... Alain De Vos via Digitalmars-d-learn
- Re: Iteratable single linked lis... Alain De Vos via Digitalmars-d-learn
- Re: Iteratable single linked... drug via Digitalmars-d-learn
- Re: Iteratable single li... Alain De Vos via Digitalmars-d-learn