mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 13:17:44 +00:00
More idiomatic signature for operator=()
Return a reference instead of void so to enable chained assignments like "p = q = Position(...);" Suggested by Rein Halbersma. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
+3
-1
@@ -89,7 +89,7 @@ CheckInfo::CheckInfo(const Position& pos) {
|
||||
/// object do not depend on any external data so we detach state pointer from
|
||||
/// the source one.
|
||||
|
||||
void Position::operator=(const Position& pos) {
|
||||
Position& Position::operator=(const Position& pos) {
|
||||
|
||||
memcpy(this, &pos, sizeof(Position));
|
||||
startState = *st;
|
||||
@@ -97,6 +97,8 @@ void Position::operator=(const Position& pos) {
|
||||
nodes = 0;
|
||||
|
||||
assert(pos_is_ok());
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user