FIFO (computing and electronics): Difference between revisions

Content deleted Content added
<source> deprecated in favor of <syntaxhighlight>
The code segment did not actually work. I will write up my fix in the talk page.
Line 26:
struct Node {
T value;
unique_ptrshared_ptr<Node> next = nullptr;
 
Node(T _value): value(_value) {}
};
 
unique_ptrshared_ptr<Node> front = nullptr;
unique_ptrshared_ptr<Node>* back = &front;
 
public:
void enqueue(T _value) {
*backif (front == make_unique<Node>(_valuenullptr); {
back front = &make_shared<Node>(**back_value).next;
back = front;
} else {
back->next = make_shared<Node>(_value);
back = back->next;
}
}