Why does the iterator of List in STL use the (*node).data instead of node->data?

Viewed 144

I recently view the source code of SGI STL. I want to know whether I can use the "->" operator to replace the (*node).data to implement the operator*(), like this:

reference operator*() const {return (*node).data;}

replaced by:

reference operator*() const {return node->data;}

in addition:

node is a pointer which points to a struct object, like this:

template<class T>
struct __list_node {
    typedef void * void_pointer;
    void_pointer prev;
    void_pointer next;
    T data;
};
1 Answers
Related