Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
lib
container
pieceVector.cc
Go to the documentation of this file.
1
#include "
osl/container/pieceVector.h
"
2
#include "
osl/eval/pieceEval.h
"
3
#include <boost/foreach.hpp>
4
#include <algorithm>
5
#include <iostream>
6
7
namespace
osl
8
{
9
struct
PieceBasicLessThan
10
{
11
bool
operator()
(
Piece
p0,
Piece
p1){
12
const
Ptype
ptype0=
unpromote
(p0.
ptype
());
13
const
Ptype
ptype1=
unpromote
(p1.
ptype
());
14
return
(
eval::Ptype_Eval_Table
.value(ptype0)
15
<
eval::Ptype_Eval_Table
.
value
(ptype1));
16
}
17
};
18
struct
PiecePtypeMoreThan
19
{
20
bool
operator()
(
Piece
p0,
Piece
p1){
21
const
PtypeO
ptypeo0=p0.
ptypeO
();
22
const
PtypeO
ptypeo1=p1.
ptypeO
();
23
return
(abs(
eval::Ptype_Eval_Table
.captureValue(ptypeo0))
24
> abs(
eval::Ptype_Eval_Table
.captureValue(ptypeo1)));
25
}
26
};
27
}
// namespace osl
28
29
void
osl::container::PieceVector::sortByBasic
()
30
{
31
std::sort(begin(),end(),
PieceBasicLessThan
());
32
}
33
34
void
osl::container::PieceVector::sortByPtype
()
35
{
36
std::sort(begin(),end(),
PiecePtypeMoreThan
());
37
}
38
39
#ifndef MINIMAL
40
std::ostream&
osl::container::operator<<
(std::ostream& os,
PieceVector
const
& pv)
41
{
42
os <<
"PieceVector"
;
43
BOOST_FOREACH(
Piece
p, pv) {
44
os <<
" "
<< p;
45
}
46
return
os << std::endl;
47
}
48
#endif
49
// ;;; Local Variables:
50
// ;;; mode:c++
51
// ;;; c-basic-offset:2
52
// ;;; End:
Generated on Sun Jul 21 2013 13:37:26 by
1.8.4