cell_iterator - rule of 5/0

For rule of 5/0, where no implementation is required, all 5 operations have been declared as defaulted. This is less likely to forget definitions for all 5 if required
- removed forwarding of copy to assignment (which was defaulted already) in favour of defaulted copy ctor
- added defaulted move assignment/ctor and destructor
This commit is contained in:
Crzyrndm 2018-05-31 13:07:02 +12:00
parent 744dd0afbb
commit 92ac3a2a2e
2 changed files with 33 additions and 14 deletions

View File

@ -64,12 +64,27 @@ public:
/// <summary> /// <summary>
/// Constructs a cell_iterator as a copy of an existing cell_iterator. /// Constructs a cell_iterator as a copy of an existing cell_iterator.
/// </summary> /// </summary>
cell_iterator(const cell_iterator &other); cell_iterator(const cell_iterator &) = default;
/// <summary> /// <summary>
/// Assigns this iterator to match the data in rhs. /// Assigns this iterator to match the data in rhs.
/// </summary> /// </summary>
cell_iterator &operator=(const cell_iterator &rhs) = default; cell_iterator &operator=(const cell_iterator &) = default;
/// <summary>
/// Constructs a cell_iterator by moving from a cell_iterator temporary
/// </summary>
cell_iterator(const cell_iterator &&) = default;
/// <summary>
/// Assigns this iterator to from a cell_iterator temporary
/// </summary>
cell_iterator &operator=(const cell_iterator &&) = default;
/// <summary>
/// destructor for const_cell_iterator
/// </summary>
~cell_iterator() = default;
/// <summary> /// <summary>
/// Dereferences this iterator to return the cell it points to. /// Dereferences this iterator to return the cell it points to.
@ -169,15 +184,29 @@ public:
const range_reference &limits, major_order order, bool skip_null, bool wrap); const range_reference &limits, major_order order, bool skip_null, bool wrap);
/// <summary> /// <summary>
/// Constructs a cell_iterator as a copy of an existing cell_iterator. /// Constructs a const_cell_iterator as a copy of an existing cell_iterator.
/// </summary> /// </summary>
const_cell_iterator(const const_cell_iterator &other); const_cell_iterator(const const_cell_iterator &) = default;
/// <summary> /// <summary>
/// Assigns this iterator to match the data in rhs. /// Assigns this iterator to match the data in rhs.
/// </summary> /// </summary>
const_cell_iterator &operator=(const const_cell_iterator &) = default; const_cell_iterator &operator=(const const_cell_iterator &) = default;
/// <summary>
/// Constructs a const_cell_iterator by moving from a const_cell_iterator temporary
/// </summary>
const_cell_iterator(const const_cell_iterator &&) = default;
/// <summary>
/// Assigns this iterator to from a const_cell_iterator temporary
/// </summary>
const_cell_iterator &operator=(const const_cell_iterator &&) = default;
/// <summary>
/// destructor for const_cell_iterator
/// </summary>
~const_cell_iterator() = default;
/// <summary> /// <summary>
/// Dereferences this iterator to return the cell it points to. /// Dereferences this iterator to return the cell it points to.
/// </summary> /// </summary>

View File

@ -58,16 +58,6 @@ const_cell_iterator::const_cell_iterator(worksheet ws, const cell_reference &cur
} }
} }
cell_iterator::cell_iterator(const cell_iterator &other)
{
*this = other;
}
const_cell_iterator::const_cell_iterator(const const_cell_iterator &other)
{
*this = other;
}
bool cell_iterator::operator==(const cell_iterator &other) const bool cell_iterator::operator==(const cell_iterator &other) const
{ {
return ws_ == other.ws_ return ws_ == other.ws_