My question is very simple, can one using C++, implment a link-list data structure without using pointers (next nodes)? To further qualify my question, I'm mean can one create a Linked-List data structure using only class instantiations.
A common node definition might be like so:
template<typename T>
struct node
{
T t;
node<T>* next;
node<T>* prev;
};
I'm aware of std::list etc, I'm just curious to know if its possible or not - and if so how? code examples will be greatly appreciated.
More clarifications:
- Insertions should be O(1)
- Traversal should be no more than O(n)
- A real node and a null node should be differentiable
- The size of the linked-list should only be limited by the amount of memory available.