X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fendgame.h;h=a5e4efecafea8831c0bc4ee032ddc5c5aa5af6c8;hp=e350022cce7351178333bf9ee11dc2b0ee175a2a;hb=4554d8b2ac1ad260c3f7123b2a7d3a3385fa8306;hpb=9cb187762a68e431559ee9e4b1ed8c6f16826d89 diff --git a/src/endgame.h b/src/endgame.h index e350022c..a5e4efec 100644 --- a/src/endgame.h +++ b/src/endgame.h @@ -20,8 +20,8 @@ #if !defined(ENDGAME_H_INCLUDED) #define ENDGAME_H_INCLUDED -#include #include +#include #include "position.h" #include "types.h" @@ -97,30 +97,24 @@ private: class Endgames { - template - struct Map { typedef std::map*> type; }; + typedef std::map*> M1; + typedef std::map*> M2; + + M1 m1; + M2 m2; + + M1& map(Value*) { return m1; } + M2& map(ScaleFactor*) { return m2; } - typedef Map::type M1; - typedef Map::type M2; + template void add(const std::string& code); public: Endgames(); ~Endgames(); - template - EndgameBase* get(Key key) const { - - typedef typename Map::type M; - typename M::const_iterator it = map().find(key); - return it != map().end() ? it->second : NULL; + template EndgameBase* get(Key key) { + return map((T*)0).count(key) ? map((T*)0)[key] : NULL; } - -private: - template void add(const std::string& keyCode); - template const M& map() const; - - M1 m1; - M2 m2; }; #endif // !defined(ENDGAME_H_INCLUDED)