circiter.h
来自「数据结构c++语言描述 Borland C++实现」· C头文件 代码 · 共 31 行
H
31 行
// iterator for circular lists
#ifndef CircularIterator_
#define CircularIterator_
template<class T>
class CircularIterator {
public:
T* Initialize(const Circular<T>& c)
{location = c.last;
last = c.last;
if (!location) return 0;
location = last->link;
return &location->data;
}
T* Next()
{if (location == last)
// no more elements
return 0;
location = location->link;
return &location->data;
}
private:
ChainNode<T> *location, // current element
*last; // last element in list
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?