-template<EndgameType>
-struct EvaluationFunction : public EndgameEvaluationFunctionBase {
- typedef EndgameEvaluationFunctionBase Base;
- explicit EvaluationFunction(Color c): EndgameEvaluationFunctionBase(c) {}
- Value apply(const Position&) const;
-};
+ template<typename T>
+ struct Map { typedef std::map<Key, EndgameBase<T>*> type; };
+
+ typedef Map<Value>::type M1;
+ typedef Map<ScaleFactor>::type M2;
+
+ Endgames();
+ ~Endgames();
+
+ template<typename T>
+ EndgameBase<T>* get(Key key) const {
+
+ typedef typename Map<T>::type M;
+ typename M::const_iterator it = map<M>().find(key);
+ return it != map<M>().end() ? it->second : NULL;
+ }
+
+private:
+ template<EndgameType E> void add(const std::string& keyCode);
+ template<typename M> const M& map() const;