mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 08:13:08 +00:00
Use for_each() in Endgames d'tor
And fix some comments while there. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
0759d8f430
commit
4a8c1b2470
3 changed files with 10 additions and 9 deletions
|
@ -17,8 +17,8 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
#include "bitcount.h"
|
||||
#include "endgame.h"
|
||||
|
@ -90,6 +90,9 @@ namespace {
|
|||
return Position(fen, false, 0).material_key();
|
||||
}
|
||||
|
||||
template<typename M>
|
||||
void delete_endgame(const typename M::value_type& p) { delete p.second; }
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
|
@ -119,11 +122,8 @@ Endgames::Endgames() {
|
|||
|
||||
Endgames::~Endgames() {
|
||||
|
||||
for (M1::const_iterator it = m1.begin(); it != m1.end(); ++it)
|
||||
delete it->second;
|
||||
|
||||
for (M2::const_iterator it = m2.begin(); it != m2.end(); ++it)
|
||||
delete it->second;
|
||||
for_each(m1.begin(), m1.end(), delete_endgame<M1>);
|
||||
for_each(m2.begin(), m2.end(), delete_endgame<M2>);
|
||||
}
|
||||
|
||||
template<EndgameType E>
|
||||
|
|
|
@ -93,9 +93,9 @@ private:
|
|||
|
||||
/// Endgames class stores in two std::map the pointers to endgame evaluation
|
||||
/// and scaling base objects. Then we use polymorphism to invoke the actual
|
||||
/// endgame function calling its apply() method that is virtual.
|
||||
/// endgame function calling its operator() method that is virtual.
|
||||
|
||||
struct Endgames {
|
||||
class Endgames {
|
||||
|
||||
template<typename T>
|
||||
struct Map { typedef std::map<Key, EndgameBase<T>*> type; };
|
||||
|
@ -103,6 +103,7 @@ struct Endgames {
|
|||
typedef Map<Value>::type M1;
|
||||
typedef Map<ScaleFactor>::type M2;
|
||||
|
||||
public:
|
||||
Endgames();
|
||||
~Endgames();
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ bool CaseInsensitiveLess::operator() (const string& s1, const string& s2) const
|
|||
|
||||
|
||||
/// OptionsMap c'tor initializes the UCI options to their hard coded default
|
||||
/// values and initializes the default value of "Threads" and "Minimum Split Depth"
|
||||
/// values and initializes the default value of "Threads" and "Min Split Depth"
|
||||
/// parameters according to the number of CPU cores detected.
|
||||
|
||||
OptionsMap::OptionsMap() {
|
||||
|
|
Loading…
Add table
Reference in a new issue