- // ...and here is the accessing template function
- template<typename T> const std::map<Key, T*>& get() const;
-};
+ template<EndgameCode E, typename T = eg_type<E>>
+ void add(const std::string& code) {
+
+ StateInfo st;
+ map<T>()[Position().set(code, WHITE, &st).material_key()] = Ptr<T>(new Endgame<E>(WHITE));
+ map<T>()[Position().set(code, BLACK, &st).material_key()] = Ptr<T>(new Endgame<E>(BLACK));
+ }
+
+ template<typename T>
+ const EndgameBase<T>* probe(Key key) {
+ return map<T>().count(key) ? map<T>()[key].get() : nullptr;
+ }
+}