ratedMoveVector.cc Source File

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ratedMoveVector.cc
Go to the documentation of this file.
1 /* ratedMoveVector.cc
2 */
3 #include "osl/rating/ratedMoveVector.h"
4 #include <boost/foreach.hpp>
5 #include <algorithm>
6 #include <functional>
7 #include <iostream>
8
9 #ifndef MINIMAL
10 std::ostream& osl::rating::operator<<(std::ostream& os, RatedMoveVector const& mv)
11 {
12 os<< "RatedMoves" << std::endl;
13 BOOST_FOREACH(const RatedMove& move, mv) {
14 os << move << std::endl;
15 }
16 return os << std::endl;
17 }
18 #endif
19
20 bool osl::rating::operator==(const RatedMoveVector& l, const RatedMoveVector& r)
21 {
22 return l.size() == r.size()
23 && std::equal(l.begin(), l.end(), r.begin());
24 }
25
26 void osl::rating::RatedMoveVector::sort()
27 {
28 std::sort(begin(), end(), std::greater<RatedMove>());
29 }
30
31 const osl::rating::RatedMove* osl::rating::RatedMoveVector::find(Move m) const
32 {
33 for (const_iterator p=begin(); p!=end(); ++p)
34 if (p->move() == m)
35 return &*p;
36 return 0;
37 }
38
39 /* ------------------------------------------------------------------------- */
40 // ;;; Local Variables:
41 // ;;; mode:c++
42 // ;;; c-basic-offset:2
43 // ;;; End:
44