truckload.h

来自「c++最经典的入门书籍」· C头文件 代码 · 共 29 行

H
29
字号
// TruckLoad.h definition of the TruckLoad class
#ifndef TRUCKLOAD_H
#define TRUCKLOAD_H
#include <list>
#include "Box.h"


class TruckLoad {
  typedef std::list<Box> Contents;                    // Private type definition

  public:
    typedef Contents::const_iterator const_iterator;  // Public type definition
    TruckLoad() {}
    TruckLoad(const Box& one_box) : load (1, one_box) {}

    template<typename FwdIter> 
    TruckLoad(FwdIter first, FwdIter last) : load(first, last) {}

    void add_box(const Box& new_box) { load.push_back(new_box); }


    const_iterator begin() const { return load.begin(); }
    const_iterator end() const { return load.end(); }

  private:
    Contents load;
};
#endif

⌨️ 快捷键说明

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