#include <SgNbIterator.h>
Iterates in sorted order. Does not filter points off board, that would need access to current board
Produces the neighbors of a point in all eight compass directions, in numerically ascending order. Directions 1, 3, 4 and 6 are vertical/horizontal, other are diagonal.
0 1 2
\ | /
3 -p- 4 e.g. next[1] = -NS
/ | \
5 6 7
Definition at line 132 of file SgNbIterator.h.
Public Member Functions | |
| SgNb8Iterator (SgPoint p) | |
| void | operator++ () |
| Advance the state of the iteration to the next element. | |
| SgPoint | operator * () const |
| Return the value of the current element. | |
| operator bool () const | |
| Return true if iteration is valid, otherwise false. | |
Static Public Member Functions | |
| static int | Direction (int i) |
Private Member Functions | |
| SgNb8Iterator (const SgNb8Iterator &) | |
| Not implemented. | |
| SgNb8Iterator & | operator= (const SgNb8Iterator &) |
| Not implemented. | |
Private Attributes | |
| int | m_next |
| SgPoint | m_p |
Static Private Attributes | |
| static const int | s_nb8 [8] |
| SgNb8Iterator::SgNb8Iterator | ( | SgPoint | p | ) |
Definition at line 135 of file SgNbIterator.h.
References SgPointUtil::InBoardRange(), and SG_ASSERT.
| SgNb8Iterator::SgNb8Iterator | ( | const SgNb8Iterator & | ) | [private] |
Not implemented.
| static int SgNb8Iterator::Direction | ( | int | i | ) | [static] |
| SgPoint SgNb8Iterator::operator * | ( | ) | const |
| SgNb8Iterator::operator bool | ( | ) | const |
Return true if iteration is valid, otherwise false.
Definition at line 156 of file SgNbIterator.h.
References m_next.
| void SgNb8Iterator::operator++ | ( | ) |
Advance the state of the iteration to the next element.
Definition at line 143 of file SgNbIterator.h.
| SgNb8Iterator& SgNb8Iterator::operator= | ( | const SgNb8Iterator & | ) | [private] |
Not implemented.
int SgNb8Iterator::m_next [private] |
Definition at line 168 of file SgNbIterator.h.
Referenced by operator *(), operator bool(), and operator++().
SgPoint SgNb8Iterator::m_p [private] |
const int SgNb8Iterator::s_nb8 [static, private] |
Initial value:
Definition at line 172 of file SgNbIterator.h.
Referenced by Direction(), and operator *().