X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fendgame.h;h=f24ac93d44a67e2d3ac286eca0888b205e67e229;hp=453d8b29d47d98780fb8a04bb00da8efed95ff8c;hb=1e8836d921b3b508e5d44d2fafab95230bdd03c6;hpb=f7d8ea3866c26df10617e97513e906d1f5a5b833 diff --git a/src/endgame.h b/src/endgame.h index 453d8b29..f24ac93d 100644 --- a/src/endgame.h +++ b/src/endgame.h @@ -67,8 +67,8 @@ enum EndgameType { /// Endgame functions can be of two types depending on whether they return a /// Value or a ScaleFactor. -template -using eg_fun = std::conditional<(E < SCALING_FUNCTIONS), Value, ScaleFactor>; +template using +eg_type = typename std::conditional<(E < SCALING_FUNCTIONS), Value, ScaleFactor>::type; /// Base and derived templates for endgame evaluation and scaling functions @@ -76,13 +76,13 @@ using eg_fun = std::conditional<(E < SCALING_FUNCTIONS), Value, ScaleFactor>; template struct EndgameBase { - virtual ~EndgameBase() {} + virtual ~EndgameBase() = default; virtual Color strong_side() const = 0; virtual T operator()(const Position&) const = 0; }; -template::type> +template> struct Endgame : public EndgameBase { explicit Endgame(Color c) : strongSide(c), weakSide(~c) {} @@ -90,7 +90,7 @@ struct Endgame : public EndgameBase { T operator()(const Position&) const; private: - const Color strongSide, weakSide; + Color strongSide, weakSide; }; @@ -100,21 +100,25 @@ private: class Endgames { - template using Map = std::map>; + template using Map = std::map>>; - template::type>> + template> void add(const std::string& code); - template>::value> - Map& map() { return std::get(maps); } + template + Map& map() { + return std::get::value>(maps); + } - std::pair>, Map>> maps; + std::pair, Map> maps; public: Endgames(); - template> E* probe(Key key) - { return map().count(key) ? map()[key].get() : nullptr; } + template + EndgameBase* probe(Key key) { + return map().count(key) ? map()[key].get() : nullptr; + } }; #endif // #ifndef ENDGAME_H_INCLUDED