X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fendgame.h;h=78b31d82ec2ab0f769327a5370f7e55740fc05ea;hp=424a3591cb80e6a67b22c784f524621186d28a98;hb=cee6336515d5772370d061aa54cf3ec9f9a0d3c2;hpb=dda0fa1a43e1096415ff8f83dd14e6322f1a8e68 diff --git a/src/endgame.h b/src/endgame.h index 424a3591..78b31d82 100644 --- a/src/endgame.h +++ b/src/endgame.h @@ -39,6 +39,7 @@ enum EndgameType { KRKP, // KR vs KP KRKB, // KR vs KB KRKN, // KR vs KN + KQKP, // KQ vs KP KQKR, // KQ vs KR KBBKN, // KBB vs KN KNNK, // KNN vs K @@ -94,7 +95,7 @@ private: /// Endgames class stores in two std::map the pointers to endgame evaluation /// and scaling base objects. Then we use polymorphism to invoke the actual -/// endgame function calling its operator() method that is virtual. +/// endgame function calling its operator() that is virtual. class Endgames { @@ -104,8 +105,8 @@ class Endgames { M1 m1; M2 m2; - M1& map(M1::value_type::second_type) { return m1; } - M2& map(M2::value_type::second_type) { return m2; } + M1& map(M1::mapped_type) { return m1; } + M2& map(M2::mapped_type) { return m2; } template void add(const std::string& code); @@ -113,9 +114,8 @@ public: Endgames(); ~Endgames(); - template EndgameBase* probe(Key key) { - return map((EndgameBase*)0).count(key) ? map((EndgameBase*)0)[key] : NULL; - } + template T probe(Key key, T& eg) + { return eg = map(eg).count(key) ? map(eg)[key] : NULL; } }; #endif // !defined(ENDGAME_H_INCLUDED)