16#ifndef dealii_linear_index_iterator_h
17#define dealii_linear_index_iterator_h
138template <
class DerivedIterator,
class AccessorType>
145#ifdef DEAL_II_HAVE_CXX20
256 template <
typename OtherIterator>
257 friend std::enable_if_t<
258 std::is_convertible<OtherIterator, DerivedIterator>::value,
262 const auto &right_2 =
static_cast<const DerivedIterator &
>(right);
263 return left.
accessor == right_2.accessor;
269 template <
typename OtherIterator>
270 friend std::enable_if_t<
271 std::is_convertible<OtherIterator, DerivedIterator>::value,
275 return !(left == right);
306 operator<(
const DerivedIterator &)
const;
335template <
class DerivedIterator,
class AccessorType>
336inline DerivedIterator &
338 const DerivedIterator &it)
340 accessor.container = it.container;
341 accessor.linear_index = it.linear_index;
342 return static_cast<DerivedIterator &
>(*this);
347template <
class DerivedIterator,
class AccessorType>
348inline DerivedIterator &
351 return operator+=(1);
356template <
class DerivedIterator,
class AccessorType>
357inline DerivedIterator
360 const DerivedIterator copy(this->accessor);
367template <
class DerivedIterator,
class AccessorType>
368inline DerivedIterator &
371 return operator+=(-1);
376template <
class DerivedIterator,
class AccessorType>
377inline DerivedIterator
380 const DerivedIterator copy(this->accessor);
387template <
class DerivedIterator,
class AccessorType>
388inline DerivedIterator
392 DerivedIterator copy(this->accessor);
399template <
class DerivedIterator,
class AccessorType>
400inline DerivedIterator
404 DerivedIterator copy(this->accessor);
411template <
class DerivedIterator,
class AccessorType>
412inline DerivedIterator &
416 accessor.linear_index += n;
417 return static_cast<DerivedIterator &
>(*this);
422template <
class DerivedIterator,
class AccessorType>
423inline DerivedIterator &
427 return operator+=(-n);
432template <
class DerivedIterator,
class AccessorType>
436 const DerivedIterator &other)
const
438 Assert(this->accessor.container == other.accessor.container,
440 "Only iterators pointing to the same container can be compared."));
441 return this->accessor.linear_index - other.accessor.linear_index;
446template <
class DerivedIterator,
class AccessorType>
455template <
class DerivedIterator,
class AccessorType>
464template <
class DerivedIterator,
class AccessorType>
467 const DerivedIterator &other)
const
469 return (*
this == other) || (*
this < other);
474template <
class DerivedIterator,
class AccessorType>
477 const DerivedIterator &other)
const
479 return !(*
this < other);
484template <
class DerivedIterator,
class AccessorType>
487 const DerivedIterator &other)
const
489 Assert(this->accessor.container == other.accessor.container,
491 "Only iterators pointing to the same container can be compared."));
492 return this->accessor.linear_index < other.accessor.linear_index;
497template <
class DerivedIterator,
class AccessorType>
500 const DerivedIterator &other)
const
502 return other < static_cast<const DerivedIterator &>(*
this);
507template <
class DerivedIterator,
class AccessorType>
509 const AccessorType accessor)
reference operator*() const
LinearIndexIterator(const AccessorType accessor)
bool operator>=(const DerivedIterator &) const
friend std::enable_if_t< std::is_convertible< OtherIterator, DerivedIterator >::value, bool > operator==(const LinearIndexIterator &left, const OtherIterator &right)
friend std::enable_if_t< std::is_convertible< OtherIterator, DerivedIterator >::value, bool > operator!=(const LinearIndexIterator &left, const OtherIterator &right)
difference_type operator-(const DerivedIterator &p) const
bool operator<=(const DerivedIterator &) const
DerivedIterator & operator++()
DerivedIterator operator--(int)
DerivedIterator operator++(int)
bool operator>(const DerivedIterator &) const
pointer operator->() const
const value_type * pointer
LinearIndexIterator()=default
DerivedIterator operator-(const difference_type n) const
std::random_access_iterator_tag iterator_category
typename value_type::size_type size_type
bool operator<(const DerivedIterator &) const
DerivedIterator operator+(const difference_type n) const
const value_type & reference
std::ptrdiff_t difference_type
DerivedIterator & operator=(const DerivedIterator &it)
DerivedIterator & operator-=(const difference_type n)
DerivedIterator & operator--()
DerivedIterator & operator+=(const difference_type n)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
static ::ExceptionBase & ExcMessage(std::string arg1)