Use std::stack instead of fixed size array

Only in not performance critical code like pretty_pv(),
otherwise continue to use the good old C-style arrays
like in extract/insert PV where I have done some code
refactoring anyhow.

No functional change.
This commit is contained in:
Marco Costalba
2012-10-26 18:01:13 +02:00
parent 00a853950f
commit cd80762c13
2 changed files with 33 additions and 33 deletions

View File

@@ -20,7 +20,7 @@
#include <cassert>
#include <iomanip>
#include <sstream>
#include <string>
#include <stack>
#include "movegen.h"
#include "notation.h"
@@ -226,7 +226,7 @@ string pretty_pv(Position& pos, int depth, Value value, int64_t msecs, Move pv[]
const int64_t K = 1000;
const int64_t M = 1000000;
StateInfo state[MAX_PLY_PLUS_2], *st = state;
std::stack<StateInfo> st;
Move* m = pv;
string san, padding;
size_t length;
@@ -261,7 +261,8 @@ string pretty_pv(Position& pos, int depth, Value value, int64_t msecs, Move pv[]
s << san << ' ';
length += san.length() + 1;
pos.do_move(*m++, *st++);
st.push(StateInfo());
pos.do_move(*m++, st.top());
}
while (m != pv)