Don't need to assert for pos.is_ok() when position is constant

It's only necessary to do the checking at the end of every non-const
member (including the constructors and from_fen()) of class Position.
Once the post-condition of every modifier guarantees the class invariant,
we don't need to verify sanity of the position as preconditions for outside
callers such as movegen, search etc. For non-class types such as Move and
Square we still need to assert of course.

Suggested by Rein Halbersma.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2011-07-16 10:42:27 +01:00
parent 69f4954df1
commit 67686b7684
7 changed files with 13 additions and 23 deletions

View File

@@ -89,9 +89,10 @@ struct StateInfo {
class Position {
// No default or copy c'tor allowed, default c'tor will not be generated
// anyhow because of user-defined c'tors.
// No defaul, copy c'tor or assignment allowed, default c'tor will not be
// generated anyhow because of user-defined c'tors.
Position(const Position&);
Position& operator=(const Position&);
public:
Position(const Position& pos, int threadID);