cell iterator - add operator->

Implementation just forwards to operator*, but this is a typical operator in the iterator API and is suprising and inconvenient that it is not present
This commit is contained in:
Crzyrndm 2018-05-31 13:18:39 +12:00
parent 20e72d69e5
commit 1c4f9c7ed2
2 changed files with 26 additions and 1 deletions

View File

@ -96,6 +96,15 @@ public:
/// </summary> /// </summary>
const reference operator*() const; const reference operator*() const;
/// <summary>
/// Dereferences this iterator to return the cell it points to.
/// </summary>
reference operator->();
/// <summary>
/// Dereferences this iterator to return the cell it points to.
/// </summary>
const reference operator->() const;
/// <summary> /// <summary>
/// Returns true if this iterator is equivalent to other. /// Returns true if this iterator is equivalent to other.
@ -222,7 +231,7 @@ public:
/// <summary> /// <summary>
/// Dereferences this iterator to return the cell it points to. /// Dereferences this iterator to return the cell it points to.
/// </summary> /// </summary>
const cell operator*() const; const reference operator->() const;
/// <summary> /// <summary>
/// Returns true if this iterator is equivalent to other. /// Returns true if this iterator is equivalent to other.

View File

@ -279,4 +279,20 @@ const const_cell_iterator::reference const_cell_iterator::operator*() const
{ {
return ws_.cell(cursor_); return ws_.cell(cursor_);
} }
cell_iterator::reference cell_iterator::operator->()
{
return operator*();
}
const cell_iterator::reference cell_iterator::operator->() const
{
return operator*();
}
const const_cell_iterator::reference const_cell_iterator::operator->() const
{
return operator*();
}
} // namespace xlnt } // namespace xlnt