range_iterator - operator* const overloads

Users may still want to dereference a const iterator (note: not a const_iterator).
Also use the "reference" typedef to ensure there is only 1 source of information
This commit is contained in:
Crzyrndm 2018-05-31 15:37:10 +12:00
parent 1e66824af0
commit bc8cd21d67
2 changed files with 14 additions and 4 deletions

View File

@ -86,7 +86,12 @@ public:
/// <summary>
/// Dereference the iterator to return a column or row.
/// </summary>
cell_vector operator*() const;
reference operator*();
/// <summary>
/// Dereference the iterator to return a column or row.
/// </summary>
const reference operator*() const;
/// <summary>
/// Returns true if this iterator is equivalent to other.
@ -196,7 +201,7 @@ public:
/// <summary>
/// Dereferennce the iterator to return the current column/row.
/// </summary>
const cell_vector operator*() const;
const reference operator*() const;
/// <summary>
/// Returns true if this iterator is equivalent to other.

View File

@ -28,7 +28,12 @@
namespace xlnt {
cell_vector range_iterator::operator*() const
range_iterator::reference range_iterator::operator*()
{
return cell_vector(ws_, cursor_, bounds_, order_, skip_null_, false);
}
const range_iterator::reference range_iterator::operator*() const
{
return cell_vector(ws_, cursor_, bounds_, order_, skip_null_, false);
}
@ -264,7 +269,7 @@ const_range_iterator const_range_iterator::operator++(int)
return old;
}
const cell_vector const_range_iterator::operator*() const
const const_range_iterator::reference const_range_iterator::operator*() const
{
return cell_vector(ws_, cursor_, bounds_, order_, skip_null_, false);
}