Non-mutable iterator over selective chess pieces in a chess position. More...
#include <PieceIterator.h>
Public Member Functions | |
Constructors | |
PieceIterator (void) | |
Construct the corresponding one-passed-the-end iterator. More... | |
PieceIterator (int) | |
Construct the corresponding one-before-the-beginning iterator. | |
PieceIterator (PieceIterator const& iter) | |
Copy-constructor. | |
PieceIterator (ChessPosition const* chess_position, BitBoard pieces) | |
Construct a fully initialized PieceIterator. More... | |
PieceIterator (ChessPosition const* chess_position, BitBoard pieces, int) | |
Construct a fully initialized PieceIterator. More... | |
Assignment operator | |
PieceIterator& | operator= (PieceIterator const& iter) |
Assign from another PieceIterator. | |
Comparison operators | |
bool | operator== (PieceIterator const& iter) const |
Return TRUE if the current index of this PieceIterator and iter are equal. | |
bool | operator!= (PieceIterator const& iter) const |
Return TRUE if the current index of this PieceIterator and iter differ. | |
Accessors | |
Piece | operator* () const |
Return the Piece that stands on the current index. | |
Piece const* | operator-> (void) const |
Return a pointer to the Piece standing on the current index. | |
Index const& | index (void) const |
Return the current index. | |
Increment and decrement operators | |
PieceIterator& | operator++ () |
PieceIterator | operator++ (int) |
PieceIterator& | operator-- () |
PieceIterator | operator-- (int) |
Protected Attributes | |
ChessPosition const* | M_chess_position |
The underlaying chess position. | |
BitBoard | M_pieces |
The pieces that the iterator will iterate over. | |
Index | M_current_index |
The index to the current piece, or 64 if this iterator points one passed the end. | |
Non-mutable iterator over selective chess pieces in a chess position.
This iterator iterates over bits in a given BitBoard, passed during creation, and returns the Piece at the given position when dereferenced.
Definition at line 42 of file PieceIterator.h.
|
inline |
Construct the corresponding one-passed-the-end iterator.
Definition at line 57 of file PieceIterator.h.
|
inline |
Construct a fully initialized PieceIterator.
chess_position | : The ChessPosition that we will retrieve the Pieces from. It is only used when the iterator is dereferenced. |
pieces | : A BitBoard with bits set for each square that the iterator should visit. |
This iterator is initialized to point at the beginning (the least significant bit). A typical loop would look as follows:
which will run over all bits set in bitboard.
Definition at line 89 of file PieceIterator.h.
|
inline |
Construct a fully initialized PieceIterator.
chess_position | : The ChessPosition that we will retrieve the Pieces from. |
pieces | : The pieces, a BitBoard with bits set for each square that the iterator should visit. |
This iterator is initialized to point at the end rather than the beginning. A typical loop would look as follows:
Definition at line 109 of file PieceIterator.h.