]> git.sesse.net Git - stockfish/commitdiff
Use ADL to skip std:: qualifier
authorMarco Costalba <mcostalba@gmail.com>
Sun, 18 Dec 2011 19:48:59 +0000 (20:48 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 18 Dec 2011 20:18:51 +0000 (21:18 +0100)
Take advantage of argument-dependent lookup (ADL) to
avoid specifying std:: qualifier in some STL functions.
When a function argument refers to a namespace (in this
case std) then the compiler will search the unqualified
function in that namespace too.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/search.cpp
src/ucioption.cpp

index ae247c0476ba700367dbddd61cc259ca6a257787..9393db6505f106db0eb7b57ecc034444cefa34df 100644 (file)
@@ -291,7 +291,7 @@ void Search::think() {
   // is given, with the subset of legal moves to search.
   for (MoveList<MV_LEGAL> ml(pos); !ml.end(); ++ml)
       if (   SearchMoves.empty()
   // is given, with the subset of legal moves to search.
   for (MoveList<MV_LEGAL> ml(pos); !ml.end(); ++ml)
       if (   SearchMoves.empty()
-          || std::count(SearchMoves.begin(), SearchMoves.end(), ml.move()))
+          || count(SearchMoves.begin(), SearchMoves.end(), ml.move()))
           RootMoves.push_back(RootMove(ml.move()));
 
   if (Options["OwnBook"].value<bool>())
           RootMoves.push_back(RootMove(ml.move()));
 
   if (Options["OwnBook"].value<bool>())
@@ -302,9 +302,9 @@ void Search::think() {
       Move bookMove = book.probe(pos, Options["Best Book Move"].value<bool>());
 
       if (   bookMove != MOVE_NONE
       Move bookMove = book.probe(pos, Options["Best Book Move"].value<bool>());
 
       if (   bookMove != MOVE_NONE
-          && std::count(RootMoves.begin(), RootMoves.end(), bookMove))
+          && count(RootMoves.begin(), RootMoves.end(), bookMove))
       {
       {
-          std::swap(RootMoves[0], *std::find(RootMoves.begin(), RootMoves.end(), bookMove));
+          std::swap(RootMoves[0], *find(RootMoves.begin(), RootMoves.end(), bookMove));
           goto finish;
       }
   }
           goto finish;
       }
   }
@@ -568,7 +568,7 @@ namespace {
         if (skillBest == MOVE_NONE) // Still unassigned ?
             skillBest = do_skill_level();
 
         if (skillBest == MOVE_NONE) // Still unassigned ?
             skillBest = do_skill_level();
 
-        std::swap(RootMoves[0], *std::find(RootMoves.begin(), RootMoves.end(), skillBest));
+        std::swap(RootMoves[0], *find(RootMoves.begin(), RootMoves.end(), skillBest));
     }
   }
 
     }
   }
 
@@ -877,7 +877,7 @@ split_point_start: // At split points actual search starts from here
       // At root obey the "searchmoves" option and skip moves not listed in Root
       // Move List, as a consequence any illegal move is also skipped. In MultiPV
       // mode we also skip PV moves which have been already searched.
       // At root obey the "searchmoves" option and skip moves not listed in Root
       // Move List, as a consequence any illegal move is also skipped. In MultiPV
       // mode we also skip PV moves which have been already searched.
-      if (RootNode && !std::count(RootMoves.begin() + PVIdx, RootMoves.end(), move))
+      if (RootNode && !count(RootMoves.begin() + PVIdx, RootMoves.end(), move))
           continue;
 
       // At PV and SpNode nodes we want all moves to be legal since the beginning
           continue;
 
       // At PV and SpNode nodes we want all moves to be legal since the beginning
@@ -1060,7 +1060,7 @@ split_point_start: // At split points actual search starts from here
       // be trusted, and we don't update the best move and/or PV.
       if (RootNode && !Signals.stop)
       {
       // be trusted, and we don't update the best move and/or PV.
       if (RootNode && !Signals.stop)
       {
-          RootMove& rm = *std::find(RootMoves.begin(), RootMoves.end(), move);
+          RootMove& rm = *find(RootMoves.begin(), RootMoves.end(), move);
           rm.nodes += pos.nodes_searched() - nodes;
 
           // PV move or new best move ?
           rm.nodes += pos.nodes_searched() - nodes;
 
           // PV move or new best move ?
index f91dd3fee08c9780b586813e10b1a679e07e2335..7b8799c48dcec9285c5d5bc10276e07619880515 100644 (file)
@@ -33,7 +33,7 @@ OptionsMap Options; // Global object
 static bool ci_less(char c1, char c2) { return tolower(c1) < tolower(c2); }
 
 bool CaseInsensitiveLess::operator() (const string& s1, const string& s2) const {
 static bool ci_less(char c1, char c2) { return tolower(c1) < tolower(c2); }
 
 bool CaseInsensitiveLess::operator() (const string& s1, const string& s2) const {
-  return std::lexicographical_compare(s1.begin(), s1.end(), s2.begin(), s2.end(), ci_less);
+  return lexicographical_compare(s1.begin(), s1.end(), s2.begin(), s2.end(), ci_less);
 }
 
 
 }