When implementing FIFO, I used the following structure:
struct Node
{
T info_;
Node* link_;
Node(T info, Node* link=0): info_(info), link_(link)
{}
};
I think this is a well-known trick for many STL containers (e.g. List). Is this a good practice? What does this mean for the compiler when you say that Node has a member with its pointer type? Is this some kind of endless loop?
And finally, if this is bad practice, how can I implement the best FIFO.
EDITOR: People, it's all about implementation. I am fairly familiar with the STL library and I know many containers from several libraries. I just want to discuss with people who can give a good implementation or good advice.
Narek source
share