⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 itemiterator.h

📁 《Big C++ 》Third Edition电子书和代码全集-Part1
💻 H
字号:
#ifndef ITEMITERATOR_H
#define ITEMITERATOR_H

#include <vector>
#include "item.h"

/**
   An iterator through a collection of items
*/
class ItemIterator
{
public:
   /**
      Constructs the iterator from a vector.
      @param its a reference to a vector of Item pointers
   */
   ItemIterator(vector<Item*>& its);
   /**
      Gets the current item.
      @return the current item pointer
   */
   Item* get() const;
   /**
      Advances to the next item.
   */
   void next();
   /**
      Tests whether there are more items.
      @return true if no more items are available.
   */
   bool is_done() const;
private:
   const vector<Item*>& items;
   int pos;
};

inline void ItemIterator::next()
{
   pos++;
}

#endif

⌨️ 快捷键说明

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