#ifndef COLH #define COLH #include #include #include using namespace std; class sudoku; class box; class col { static const size_t root = 3; static const size_t n = root * root; sudoku *p; size_t x; public: friend class sudoku; class iterator: public std::iterator { sudoku *const p; const size_t x; 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++() {++y; 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, x, 0);} iterator end() const {return iterator(p, x, n);} }; inline bool operator!=(const col::iterator& it1, const col::iterator& it2) { return !(it1 == it2); } #endif