]> git.sesse.net Git - stockfish/commitdiff
Avoid friend
authorlucasart <lucas.braesch@gmail.com>
Sun, 8 Nov 2015 06:26:39 +0000 (14:26 +0800)
committerJoona Kiiski <joona@zoox.com>
Tue, 10 Nov 2015 21:46:02 +0000 (21:46 +0000)
operator<<(os, pos) does not need to access any private members of pos.

No functional change.

Resolves #492

src/position.cpp
src/position.h

index c432bb90e9f51fcf93d7f246a04b98916aeb4366..0be3301a9e09467e9bc4970255f2e52c05696dcb 100644 (file)
@@ -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)) << " ";
index 0d34aba44fe1c9e8fe74ba71dc4532e03f975cbc..0f1620b115600e0402705075e737bb43fbd96b6e 100644 (file)
@@ -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;
 }