My Project
moveStack.h
Go to the documentation of this file.
1#ifndef _MOVE_STACK_H
2#define _MOVE_STACK_H
3#include "osl/container.h"
4#include <vector>
5#include <cassert>
6namespace osl
7{
8 namespace container
9 {
15 {
16 typedef std::vector<Move> vector_t;
18 public:
19 MoveStack();
20 ~MoveStack();
21
22 void reserve(size_t);
23 void clear();
24 void push(Move m) { data.push_back(m); }
25 void pop() { data.pop_back(); }
27 bool hasLastMove(size_t last=1) const { return size()>=last; }
28 const Move lastMove(size_t last=1) const
29 {
30 const size_t index = data.size() - last;
31 assert(index < data.size());
32 return data[index];
33 }
34 size_t size() const { return data.size()-2; }
38 void dump(size_t last_n=0) const;
39 void dump(std::ostream&, size_t last_n=0) const;
40 bool operator==(const MoveStack& r) const
41 {
42 return data == r.data;
43 }
44 };
45} // namespace container
46 using container::MoveStack;
47} // namespace osl
48#endif // _MOVE_STACK_H
49// ;;; Local Variables:
50// ;;; mode:c++
51// ;;; c-basic-offset:2
52// ;;; End:
圧縮していない moveの表現 .
std::vector< Move > vector_t
Definition moveStack.h:16
bool hasLastMove(size_t last=1) const
Definition moveStack.h:27
void dump(size_t last_n=0) const
Definition moveStack.cc:43
bool operator==(const MoveStack &r) const
Definition moveStack.h:40
size_t size() const
Definition moveStack.h:34
const Move lastMove(size_t last=1) const
Definition moveStack.h:28