hciter.h

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

H
31
字号


// iterator for circular lists

#ifndef HCircularIterator_
#define HCircularIterator_


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

⌨️ 快捷键说明

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