range_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 ctor 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 15:27:20 +12:00
parent 266016b685
commit 89e44f20c8
2 changed files with 44 additions and 24 deletions

View File

@ -59,20 +59,35 @@ public:
const range_reference &bounds, major_order order, bool skip_null);
/// <summary>
/// Copy constructor.
/// Default copy constructor.
/// </summary>
range_iterator(const range_iterator &other);
/// <summary>
/// Dereference the iterator to return a column or row.
/// </summary>
cell_vector operator*() const;
range_iterator(const range_iterator &) = default;
/// <summary>
/// Default assignment operator.
/// </summary>
range_iterator &operator=(const range_iterator &) = default;
/// <summary>
/// Default move constructor.
/// </summary>
range_iterator(range_iterator &&) = default;
/// <summary>
/// Default move assignment operator.
/// </summary>
range_iterator &operator=(range_iterator &&) = default;
/// <summary>
/// Default destructor
/// </summary>
~range_iterator() = default;
/// <summary>
/// Dereference the iterator to return a column or row.
/// </summary>
cell_vector operator*() const;
/// <summary>
/// Returns true if this iterator is equivalent to other.
/// </summary>
@ -154,20 +169,35 @@ public:
const range_reference &bounds, major_order order, bool skip_null);
/// <summary>
/// Copy constructor.
/// Default copy constructor.
/// </summary>
const_range_iterator(const const_range_iterator &other);
/// <summary>
/// Dereferennce the iterator to return the current column/row.
/// </summary>
const cell_vector operator*() const;
const_range_iterator(const const_range_iterator &) = default;
/// <summary>
/// Default assignment operator.
/// </summary>
const_range_iterator &operator=(const const_range_iterator &) = default;
/// <summary>
/// Default move constructor.
/// </summary>
const_range_iterator(const_range_iterator &&) = default;
/// <summary>
/// Default move assignment operator.
/// </summary>
const_range_iterator &operator=(const_range_iterator &&) = default;
/// <summary>
/// Default destructor
/// </summary>
~const_range_iterator() = default;
/// <summary>
/// Dereferennce the iterator to return the current column/row.
/// </summary>
const cell_vector operator*() const;
/// <summary>
/// Returns true if this iterator is equivalent to other.
/// </summary>

View File

@ -47,11 +47,6 @@ range_iterator::range_iterator(worksheet &ws, const cell_reference &cursor,
}
}
range_iterator::range_iterator(const range_iterator &other)
{
*this = other;
}
bool range_iterator::operator==(const range_iterator &other) const
{
return ws_ == other.ws_
@ -168,11 +163,6 @@ const_range_iterator::const_range_iterator(const worksheet &ws, const cell_refer
}
}
const_range_iterator::const_range_iterator(const const_range_iterator &other)
{
*this = other;
}
bool const_range_iterator::operator==(const const_range_iterator &other) const
{
return ws_ == other.ws_