diff --git a/include/xlnt/workbook/worksheet_iterator.hpp b/include/xlnt/workbook/worksheet_iterator.hpp index d0ac56e7..b2830f88 100644 --- a/include/xlnt/workbook/worksheet_iterator.hpp +++ b/include/xlnt/workbook/worksheet_iterator.hpp @@ -37,18 +37,22 @@ class worksheet; // because one needs to point at a const workbook and the other needs // to point at a non-const workbook stored as a member variable, respectively. -/// -/// Alias the parent class of this iterator to increase clarity. -/// -using ws_iter_type = std::iterator; /// /// An iterator which is used to iterate over the worksheets in a workbook. /// -class XLNT_API worksheet_iterator : public ws_iter_type +class XLNT_API worksheet_iterator { public: + /// + /// iterator tags required for use with standard algorithms and adapters + /// + using iterator_category = std::bidirectional_iterator_tag; + using value_type = worksheet; + using difference_type = std::ptrdiff_t; + using pointer = worksheet *; + using reference = worksheet; // intentionally value + /// /// Constructs a worksheet iterator from a workbook and sheet index. /// @@ -106,18 +110,21 @@ private: }; -/// -/// Alias the parent class of this iterator to increase clarity. -/// -using c_ws_iter_type = std::iterator; - /// /// An iterator which is used to iterate over the worksheets in a const workbook. /// -class XLNT_API const_worksheet_iterator : public c_ws_iter_type +class XLNT_API const_worksheet_iterator { public: + /// + /// iterator tags required for use with standard algorithms and adapters + /// + using iterator_category = std::bidirectional_iterator_tag; + using value_type = const worksheet; + using difference_type = std::ptrdiff_t; + using pointer = const worksheet *; + using reference = const worksheet; // intentionally value + /// /// Constructs a worksheet iterator from a workbook and sheet index. /// diff --git a/include/xlnt/worksheet/cell_iterator.hpp b/include/xlnt/worksheet/cell_iterator.hpp index 496dd6a9..5f7b24eb 100644 --- a/include/xlnt/worksheet/cell_iterator.hpp +++ b/include/xlnt/worksheet/cell_iterator.hpp @@ -40,18 +40,21 @@ class cell; class cell_reference; class range_reference; -/// -/// Alias the parent class of this iterator to increase clarity. -/// -using c_iter_type = std::iterator; - /// /// A cell iterator iterates over a 1D range by row or by column. /// -class XLNT_API cell_iterator : public c_iter_type +class XLNT_API cell_iterator { public: + /// + /// iterator tags required for use with standard algorithms and adapters + /// + using iterator_category = std::bidirectional_iterator_tag; + using value_type = cell; + using difference_type = std::ptrdiff_t; + using pointer = cell *; + using reference = cell; // intentionally value + /// /// Constructs a cell_iterator from a worksheet, range, and iteration settings. /// @@ -135,7 +138,7 @@ private: /// If true, cells that don't exist in the worksheet will be skipped during iteration. /// bool skip_null_; - + /// /// If true, when on the last column, the cursor will continue to the next row /// (and vice versa when iterating in column-major order) until reaching the @@ -144,18 +147,21 @@ private: bool wrap_; }; -/// -/// Alias the parent class of this iterator to increase clarity. -/// -using cc_iter_type = std::iterator; - /// /// A cell iterator iterates over a 1D range by row or by column. /// -class XLNT_API const_cell_iterator : public cc_iter_type +class XLNT_API const_cell_iterator { public: + /// + /// iterator tags required for use with standard algorithms and adapters + /// + using iterator_category = std::bidirectional_iterator_tag; + using value_type = const cell; + using difference_type = std::ptrdiff_t; + using pointer = const cell *; + using reference = const cell; // intentionally value + /// /// Constructs a cell_iterator from a worksheet, range, and iteration settings. /// diff --git a/include/xlnt/worksheet/range_iterator.hpp b/include/xlnt/worksheet/range_iterator.hpp index cdd51d84..351e257f 100644 --- a/include/xlnt/worksheet/range_iterator.hpp +++ b/include/xlnt/worksheet/range_iterator.hpp @@ -35,19 +35,22 @@ namespace xlnt { class cell_vector; -/// -/// Alias the parent class of this iterator to increase clarity. -/// -using r_iter_type = std::iterator; - /// /// An iterator used by worksheet and range for traversing /// a 2D grid of cells by row/column then across that row/column. /// -class XLNT_API range_iterator : public r_iter_type +class XLNT_API range_iterator { public: + /// + /// iterator tags required for use with standard algorithms and adapters + /// + using iterator_category = std::bidirectional_iterator_tag; + using value_type = cell_vector; + using difference_type = std::ptrdiff_t; + using pointer = cell_vector *; + using reference = cell_vector; // intentionally value + /// /// Constructs a range iterator on a worksheet, cell pointing to the current /// row or column, range bounds, an order, and whether or not to skip null column/rows. @@ -127,19 +130,22 @@ private: bool skip_null_; }; -/// -/// Alias the parent class of this iterator to increase clarity. -/// -using cr_iter_type = std::iterator; - /// /// A const version of range_iterator which does not allow modification /// to the dereferenced cell_vector. /// -class XLNT_API const_range_iterator : public cr_iter_type +class XLNT_API const_range_iterator { public: + /// + /// this iterator meets the interface requirements of bidirection_iterator + /// + using iterator_category = std::bidirectional_iterator_tag; + using value_type = const cell_vector; + using difference_type = std::ptrdiff_t; + using pointer = const cell_vector *; + using reference = const cell_vector; // intentionally value + /// /// Constructs a range iterator on a worksheet, cell pointing to the current /// row or column, range bounds, an order, and whether or not to skip null column/rows.