From fca8dbc0295c27ee8b2e3ee8cc217edd36f20127 Mon Sep 17 00:00:00 2001 From: lucasart Date: Sun, 8 Nov 2015 14:26:39 +0800 Subject: [PATCH] Avoid friend operator<<(os, pos) does not need to access any private members of pos. No functional change. Resolves #492 --- src/position.cpp | 2 +- src/position.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index c432bb90..0be3301a 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -118,7 +118,7 @@ std::ostream& operator<<(std::ostream& os, const Position& pos) { } os << "\nFen: " << pos.fen() << "\nKey: " << std::hex << std::uppercase - << std::setfill('0') << std::setw(16) << pos.st->key << std::dec << "\nCheckers: "; + << std::setfill('0') << std::setw(16) << pos.key() << std::dec << "\nCheckers: "; for (Bitboard b = pos.checkers(); b; ) os << UCI::square(pop_lsb(&b)) << " "; diff --git a/src/position.h b/src/position.h index 0d34aba4..0f1620b1 100644 --- a/src/position.h +++ b/src/position.h @@ -82,8 +82,6 @@ struct StateInfo { class Position { - friend std::ostream& operator<<(std::ostream&, const Position&); - public: static void init(); @@ -210,6 +208,8 @@ private: bool chess960; }; +extern std::ostream& operator<<(std::ostream& os, const Position& pos); + inline Color Position::side_to_move() const { return sideToMove; } -- 2.39.2