00001 /* ratedMoveVector.cc 00002 */ 00003 #include "osl/rating/ratedMoveVector.h" 00004 #include <boost/foreach.hpp> 00005 #include <algorithm> 00006 #include <functional> 00007 #include <iostream> 00008 00009 #ifndef MINIMAL 00010 std::ostream& osl::rating::operator<<(std::ostream& os, RatedMoveVector const& mv) 00011 { 00012 os<< "RatedMoves" << std::endl; 00013 BOOST_FOREACH(const RatedMove& move, mv) { 00014 os << move << std::endl; 00015 } 00016 return os << std::endl; 00017 } 00018 #endif 00019 00020 bool osl::rating::operator==(const RatedMoveVector& l, const RatedMoveVector& r) 00021 { 00022 return l.size() == r.size() 00023 && std::equal(l.begin(), l.end(), r.begin()); 00024 } 00025 00026 void osl::rating::RatedMoveVector::sort() 00027 { 00028 std::sort(begin(), end(), std::greater<RatedMove>()); 00029 } 00030 00031 const osl::rating::RatedMove* osl::rating::RatedMoveVector::find(Move m) const 00032 { 00033 for (const_iterator p=begin(); p!=end(); ++p) 00034 if (p->move() == m) 00035 return &*p; 00036 return 0; 00037 } 00038 00039 /* ------------------------------------------------------------------------- */ 00040 // ;;; Local Variables: 00041 // ;;; mode:c++ 00042 // ;;; c-basic-offset:2 00043 // ;;; End: 00044