* Iterator for constant and non-constant matrices.
*
* This iterator is abstracted from the actual matrix type and can be used for
- * any matrix having the required ACCESSOR type.
+ * any matrix having the required AccessorType type.
*/
-template <class ACCESSOR>
+template <typename AccessorType>
class MatrixIterator
{
public:
/**
* Typedef for the matrix type (including constness) we are to operate on.
*/
- using MatrixType = typename ACCESSOR::MatrixType;
+ using MatrixType = typename AccessorType::MatrixType;
/**
* Constructor. Create an iterator into the matrix <tt>matrix</tt> for the
/**
* Copy from another matrix iterator. Mostly implemented to allow
* initialization of a constant iterator from a non constant, this function
- * only requires that a conversion from the other iterator's accessor to
- * this accessor object is possible.
+ * only requires that a conversion from the other iterator's AccessorType to
+ * this AccessorType object is possible.
*/
- template <class OtherAccessor>
- MatrixIterator(const MatrixIterator<OtherAccessor> &other);
+ template <class OtherAccessorType>
+ MatrixIterator(const MatrixIterator<OtherAccessorType> &other);
/**
* Prefix increment.
/**
* Dereferencing operator.
*/
- const ACCESSOR &
+ const AccessorType &
operator*() const;
/**
* Dereferencing operator.
*/
- const ACCESSOR *
+ const AccessorType *
operator->() const;
/**
* Comparison. True, if both accessors are equal.
*/
- template <class OtherAccessor>
+ template <class OtherAccessorType>
bool
- operator==(const MatrixIterator<OtherAccessor> &) const;
+ operator==(const MatrixIterator<OtherAccessorType> &) const;
/**
* Inverse of <tt>==</tt>.
*/
- template <class OtherAccessor>
+ template <class OtherAccessorType>
bool
- operator!=(const MatrixIterator<OtherAccessor> &) const;
+ operator!=(const MatrixIterator<OtherAccessorType> &) const;
/**
* Comparison operator. Result is true if either the first row number is
private:
/**
- * Store an object of the accessor class.
+ * Store an object of the AccessorType class.
*/
- ACCESSOR accessor;
+ AccessorType accessor;
// Allow other iterators access to private data.
- template <class OtherAccessor>
+ template <class OtherAccessorType>
friend class MatrixIterator;
};
//----------------------------------------------------------------------//
-template <class ACCESSOR>
-inline MatrixIterator<ACCESSOR>::MatrixIterator(MatrixType *matrix,
- const size_type r,
- const size_type i)
+template <typename AccessorType>
+inline MatrixIterator<AccessorType>::MatrixIterator(MatrixType *matrix,
+ const size_type r,
+ const size_type i)
: accessor(matrix, r, i)
{}
-template <class ACCESSOR>
-template <class OtherAccessor>
-inline MatrixIterator<ACCESSOR>::MatrixIterator(
- const MatrixIterator<OtherAccessor> &other)
+template <typename AccessorType>
+template <class OtherAccessorType>
+inline MatrixIterator<AccessorType>::MatrixIterator(
+ const MatrixIterator<OtherAccessorType> &other)
: accessor(other.accessor)
{}
-template <class ACCESSOR>
-inline MatrixIterator<ACCESSOR> &
-MatrixIterator<ACCESSOR>::operator++()
+template <typename AccessorType>
+inline MatrixIterator<AccessorType> &
+MatrixIterator<AccessorType>::operator++()
{
accessor.advance();
return *this;
}
-template <class ACCESSOR>
-inline MatrixIterator<ACCESSOR>
-MatrixIterator<ACCESSOR>::operator++(int)
+template <typename AccessorType>
+inline MatrixIterator<AccessorType>
+MatrixIterator<AccessorType>::operator++(int)
{
const MatrixIterator iter = *this;
accessor.advance();
}
-template <class ACCESSOR>
-inline const ACCESSOR &
-MatrixIterator<ACCESSOR>::operator*() const
+template <typename AccessorType>
+inline const AccessorType &
+MatrixIterator<AccessorType>::operator*() const
{
return accessor;
}
-template <class ACCESSOR>
-inline const ACCESSOR *
-MatrixIterator<ACCESSOR>::operator->() const
+template <typename AccessorType>
+inline const AccessorType *
+MatrixIterator<AccessorType>::operator->() const
{
return &accessor;
}
-template <class ACCESSOR>
-template <class OtherAccessor>
+template <typename AccessorType>
+template <class OtherAccessorType>
inline bool
-MatrixIterator<ACCESSOR>::operator==(
- const MatrixIterator<OtherAccessor> &other) const
+MatrixIterator<AccessorType>::operator==(
+ const MatrixIterator<OtherAccessorType> &other) const
{
return (accessor == other.accessor);
}
-template <class ACCESSOR>
-template <class OtherAccessor>
+template <typename AccessorType>
+template <class OtherAccessorType>
inline bool
-MatrixIterator<ACCESSOR>::operator!=(
- const MatrixIterator<OtherAccessor> &other) const
+MatrixIterator<AccessorType>::operator!=(
+ const MatrixIterator<OtherAccessorType> &other) const
{
return !(*this == other);
}
-template <class ACCESSOR>
+template <typename AccessorType>
inline bool
-MatrixIterator<ACCESSOR>::operator<(const MatrixIterator &other) const
+MatrixIterator<AccessorType>::operator<(const MatrixIterator &other) const
{
Assert(&accessor.get_matrix() == &other.accessor.get_matrix(),
ExcInternalError());
}
-template <class ACCESSOR>
+template <typename AccessorType>
inline bool
-MatrixIterator<ACCESSOR>::operator>(const MatrixIterator &other) const
+MatrixIterator<AccessorType>::operator>(const MatrixIterator &other) const
{
return (other < *this);
}