#ifndef ROWH #define ROWH #include #include #include using namespace std; class sudoku; class box; class row { static const size_t root = 3; static const size_t n = root * root; sudoku *p; size_t y; public: friend class sudoku; class iterator: public std::iterator { sudoku *const p; size_t x; const size_t y; public: iterator(sudoku *initial_p, size_t initial_x, size_t initial_y): p(initial_p), x(initial_x), y(initial_y) {} box& operator*() const; box *operator->() const {return &**this;} iterator& operator++() {++x; return *this;} friend bool operator==(const iterator& it1, const iterator& it2) { return it1.p == it2.p && it1.x == it2.x && it1.y == it2.y; } }; iterator begin() const {return iterator(p, 0, y);} iterator end() const {return iterator(p, n, y);} }; inline bool operator!=(const row::iterator& it1, const row::iterator& it2) { return !(it1 == it2); } #endif