Hello. Can anyone help me how to implement the subscript ([]) operator for a STL list class ?
T& operator [] (int n)
{
}
template <typename T>
class list
{
public:
struct node
{
T data;
node* prev;
node* next;
node(T t, node* p, node* n) : data(t), prev(p), next(n) {}
};
node* head;
node* tail;
public:
class Iterator;
friend class Iterator;
list() : head( NULL ), tail ( NULL ) {}
...................................................................
i dont know what to return