Skip to content

Commit

Permalink
Avoid friend
Browse files Browse the repository at this point in the history
operator<<(os, pos) does not need to access any private members of pos.

No functional change.

Resolves official-stockfish#492
  • Loading branch information
lucasart authored and zamar committed Nov 10, 2015
1 parent e6eeb17 commit fca8dbc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/position.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) << " ";
Expand Down
4 changes: 2 additions & 2 deletions src/position.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ struct StateInfo {

class Position {

friend std::ostream& operator<<(std::ostream&, const Position&);

public:
static void init();

Expand Down Expand Up @@ -210,6 +208,8 @@ class Position {
bool chess960;
};

extern std::ostream& operator<<(std::ostream& os, const Position& pos);

inline Color Position::side_to_move() const {
return sideToMove;
}
Expand Down

0 comments on commit fca8dbc

Please sign in to comment.