hdbliter.h

来自「数据结构c++语言描述 Borland C++实现」· C头文件 代码 · 共 31 行

H
31
字号

// iterator for doubly-linked circular lists
// with a head node

#ifndef HDoubleCircularIterator_
#define HDoubleCircularIterator_


template<class T>
class HDoubleCircularIterator {
   public:
      T* Initialize(const HDoubleCircular<T>& c)
            {location = c.head->right;
             head = c.head;
             if (location == head) return 0;
             else return &location->data;
             }
      T* Next()
             {if (location->right == head)
                 // no more elements
                 return 0;
             location = location->right;
             return &location->data;
             }
   private:
      DoubleNode<T> *location,  // current element
                    *head;      // head node
};
 
#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?