moveStack.h
Go to the documentation of this file.
#ifndef _MOVE_STACK_H
#define _MOVE_STACK_H
#include "osl/container.h"
#include <vector>
#include <cassert>
namespace osl
{
namespace container
{
class MoveStack
{
typedef std::vector<Move> vector_t;
vector_t data;
public:
MoveStack();
~MoveStack();
void reserve(size_t);
void clear();
void push(Move m) { data.push_back(m); }
void pop() { data.pop_back(); }
bool hasLastMove(size_t last=1) const { return size()>=last; }
const Move lastMove(size_t last=1) const
{
const size_t index = data.size() - last;
assert(index < data.size());
return data[index];
}
size_t size() const { return data.size()-2; }
void dump(size_t last_n=0) const;
void dump(std::ostream&, size_t last_n=0) const;
bool operator==(const MoveStack& r) const
{
return data == r.data;
}
};
} // namespace container
using container::MoveStack;
} // namespace osl
#endif // _MOVE_STACK_H
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
osl::Move
圧縮していない moveの表現 .
Definition basic_type.h:1052
osl::container::MoveStack::clear
void clear()
Definition moveStack.cc:20
osl::container::MoveStack::~MoveStack
~MoveStack()
Definition moveStack.cc:11
osl::container::MoveStack::vector_t
std::vector< Move > vector_t
Definition moveStack.h:16
osl::container::MoveStack::MoveStack
MoveStack()
Definition moveStack.cc:5
osl::container::MoveStack::push
void push(Move m)
Definition moveStack.h:24
osl::container::MoveStack::reserve
void reserve(size_t)
Definition moveStack.cc:15
osl::container::MoveStack::hasLastMove
bool hasLastMove(size_t last=1) const
Definition moveStack.h:27
osl::container::MoveStack::dump
void dump(size_t last_n=0) const
Definition moveStack.cc:43
osl::container::MoveStack::data
vector_t data
Definition moveStack.h:17
osl::container::MoveStack::pop
void pop()
Definition moveStack.h:25
osl::container::MoveStack::operator==
bool operator==(const MoveStack &r) const
Definition moveStack.h:40
osl::container::MoveStack::size
size_t size() const
Definition moveStack.h:34
osl::container::MoveStack::lastMove
const Move lastMove(size_t last=1) const
Definition moveStack.h:28
container.h
osl::container
Definition bitXmask.h:12
osl
Definition additionalEffect.h:6