Iterator over both colors, Black and White. More...
#include <SgBlackWhite.h>
Public Member Functions | |
SgBWIterator () | |
void | operator++ () |
Advance the state of the iteration to the next element. | |
SgBlackWhite | operator* () const |
Return the value of the current element. | |
SgBlackWhite | Opp () const |
Return the value of the current element. | |
operator bool () const | |
Return true if iteration is valid, otherwise false. | |
Private Member Functions | |
SgBWIterator (const SgBWIterator &) | |
Not implemented. | |
SgBWIterator & | operator= (const SgBWIterator &) |
Not implemented. | |
Private Attributes | |
int | m_color |
Iterator over both colors, Black and White.
The function Opp() returns the opponent since this is often needed too.
Usage example:
for (SgBWIterator it; it; ++it) { "this section will be executed twice:" "first with *it == SG_BLACK, then with *it == SG_WHITE" (unless it encounters a break or return inside) }
Definition at line 58 of file SgBlackWhite.h.
SgBWIterator::SgBWIterator | ( | ) |
Definition at line 61 of file SgBlackWhite.h.
SgBWIterator::SgBWIterator | ( | const SgBWIterator & | ) | [private] |
Not implemented.
SgBWIterator::operator bool | ( | ) | const |
Return true if iteration is valid, otherwise false.
Definition at line 85 of file SgBlackWhite.h.
SgBlackWhite SgBWIterator::operator* | ( | ) | const |
Return the value of the current element.
Definition at line 73 of file SgBlackWhite.h.
References m_color.
void SgBWIterator::operator++ | ( | ) |
Advance the state of the iteration to the next element.
Definition at line 66 of file SgBlackWhite.h.
References m_color, and SG_ASSERT_BW.
SgBWIterator& SgBWIterator::operator= | ( | const SgBWIterator & | ) | [private] |
Not implemented.
SgBlackWhite SgBWIterator::Opp | ( | ) | const |
Return the value of the current element.
Definition at line 79 of file SgBlackWhite.h.
int SgBWIterator::m_color [private] |
Definition at line 91 of file SgBlackWhite.h.
Referenced by operator bool(), operator*(), operator++(), and Opp().