X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fendgame.h;h=d91ec40f8531a4bbb09a7eaec5cdeb98ee73c1b4;hp=e350022cce7351178333bf9ee11dc2b0ee175a2a;hb=e9296d694c72c2378b71ad29cfff2f2c7b45bb0c;hpb=4a8c1b24702ddf577853d72962cee6735a0235da diff --git a/src/endgame.h b/src/endgame.h index e350022c..d91ec40f 100644 --- a/src/endgame.h +++ b/src/endgame.h @@ -1,7 +1,7 @@ /* Stockfish, a UCI chess playing engine derived from Glaurung 2.1 Copyright (C) 2004-2008 Tord Romstad (Glaurung author) - Copyright (C) 2008-2010 Marco Costalba, Joona Kiiski, Tord Romstad + Copyright (C) 2008-2012 Marco Costalba, Joona Kiiski, Tord Romstad Stockfish is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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)