FIFO implementation
Posted
by Narek
on Stack Overflow
See other posts from Stack Overflow
or by Narek
Published on 2010-06-13T19:20:25Z
Indexed on
2010/06/13
19:32 UTC
Read the original article
Hit count: 321
While implementing a FIFO I have used the following structure:
struct Node
{
T info_;
Node* link_;
Node(T info, Node* link=0): info_(info), link_(link)
{}
};
I think this a well known trick for lots of STL containers (for example for List). Is this a good practice? What it means for compiler when you say that Node has a member with a type of it's pointer? Is this a kind of infinite loop?
And finally, if this is a bad practice, how I could implement a better FIFO.
EDIT: People, this is all about implemenation. I am enough familiar with STL library, and know a plenty of containers from several libraries. Just I want to discuss with people who can gave a good implementation or a good advice.
© Stack Overflow or respective owner