When trying to increment a sparsity pattern iterator:
auto iterator = sparsity_pattern.begin();
iterator++;
The corresponding function in LinearIndexIterator:
template <class DerivedIterator, class AccessorType>
inline DerivedIterator
LinearIndexIterator<DerivedIterator, AccessorType>::operator++(int)
{
const DerivedIterator copy(this->accessor);
operator+=(1);
return copy;
}
creates a copy that is initialized by the accessor. Thus, we need a
constructor that can create an interator from an accessor.
* the zeroth row).
*/
Iterator(const SparsityPattern *sp, const std::size_t linear_index);
+
+ /**
+ * Constructor. Create an iterator into the sparsity pattern @p sp for
+ * a given accessor.
+ */
+ Iterator(const Accessor &accessor);
};
} // namespace SparsityPatternIterators
const std::size_t linear_index)
: LinearIndexIterator<Iterator, Accessor>(Accessor(sp, linear_index))
{}
+
+
+ inline Iterator::Iterator(const Accessor &accessor)
+ : LinearIndexIterator<Iterator, Accessor>(accessor)
+ {}
+
+
} // namespace SparsityPatternIterators
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams