It would make the code much simpler to use smart pointers and polymorphism instead of all the crazy template parameters that are passed everywhere. We can also use inheritance for nested classes: KonaneGame::State would inherit from Game::State and KonaneGame::Move would inherit from Game::Move.
Game::State could have pure virtual methods: virtual size_t hash() const = 0 and virtual bool operator== (const Game::State& gs) const = 0. Then we could specialize std::hash<Game::State> to call Game::State::hash().
Note: I currently don't now of a way to enforce that classes that inherit from Game implement the two nested classes Game::State and Game::Move.
It would make the code much simpler to use smart pointers and polymorphism instead of all the crazy template parameters that are passed everywhere. We can also use inheritance for nested classes:
KonaneGame::State
would inherit fromGame::State
andKonaneGame::Move
would inherit fromGame::Move
.Game::State
could have pure virtual methods:virtual size_t hash() const = 0
andvirtual bool operator== (const Game::State& gs) const = 0
. Then we could specializestd::hash<Game::State>
to callGame::State::hash()
.Note: I currently don't now of a way to enforce that classes that inherit from
Game
implement the two nested classesGame::State
andGame::Move
.