説明を見る。00001 #ifndef _MOVE_STACK_H
00002 #define _MOVE_STACK_H
00003 #include "osl/container.h"
00004 #include <vector>
00005 #include <cassert>
00006 namespace osl
00007 {
00008 namespace container
00009 {
00014 class MoveStack
00015 {
00016 typedef std::vector<Move> vector_t;
00017 vector_t data;
00018 public:
00019 MoveStack();
00020 ~MoveStack();
00021
00022 void reserve(size_t);
00023 void clear();
00024 void push(Move m) { data.push_back(m); }
00025 void pop() { data.pop_back(); }
00027 bool hasLastMove(size_t last=1) const { return size()>=last; }
00028 const Move lastMove(size_t last=1) const
00029 {
00030 const size_t index = data.size() - last;
00031 assert(index < data.size());
00032 return data[index];
00033 }
00034 size_t size() const { return data.size()-2; }
00038 void dump(size_t last_n=0) const;
00039 void dump(std::ostream&, size_t last_n=0) const;
00040 bool operator==(const MoveStack& r) const
00041 {
00042 return data == r.data;
00043 }
00044 };
00045 }
00046 using container::MoveStack;
00047 }
00048 #endif // _MOVE_STACK_H
00049
00050
00051
00052