33 #define DEBUG_ARRAY_RANGE_CHECK 0 35 #if DEBUG_ARRAY_RANGE_CHECK 45 T& operator[](
Code const& code)
47 #if DEBUG_ARRAY_RANGE_CHECK 50 return M_array[code()];
52 T
const& operator[](
Code const& code)
const 54 #if DEBUG_ARRAY_RANGE_CHECK 57 return M_array[code()];
60 T& operator[](
Color const& color)
62 #if DEBUG_ARRAY_RANGE_CHECK 63 assert(color() == 0 || color() == 8);
65 return M_array[color()];
67 T
const& operator[](
Color const& color)
const 69 #if DEBUG_ARRAY_RANGE_CHECK 70 assert(color() == 0 || color() == 8);
72 return M_array[color()];
80 T& operator[](
Code const& code)
82 #if DEBUG_ARRAY_RANGE_CHECK 85 return M_array[code() >> 3];
87 T
const& operator[](
Code const& code)
const 89 #if DEBUG_ARRAY_RANGE_CHECK 92 return M_array[code() >> 3];
95 T& operator[](
Color const& color)
97 #if DEBUG_ARRAY_RANGE_CHECK 98 assert(color.
index() < 2);
100 return M_array[color.
index()];
102 T
const& operator[](
Color const& color)
const 104 #if DEBUG_ARRAY_RANGE_CHECK 105 assert(color.
index() < 2);
107 return M_array[color.
index()];
115 T& operator[](
Index const& index)
117 #if DEBUG_ARRAY_RANGE_CHECK 118 assert(index() < 64);
120 return M_array[index()];
122 T
const& operator[](
Index const& index)
const 124 #if DEBUG_ARRAY_RANGE_CHECK 125 assert(index() < 64);
127 return M_array[index()];
A namespace for all chess related objects that are not related to the GUI.
This file contains the declaration of class Index.
uint8_t index(void) const
Return a number that can be used as array index.
The index of a chess square.
A chess piece type including color.
This file contains the declaration of class Color.
A color (black or white).