template<typename Derived, bool Contiguous = false>
slang::iterator_facade class

Iterator facade which infers iterator types and functionality.

Template parameters
Derived iterator subclass type which implements:
Contiguous true if the derived iterator is contiguous, otherwise false (since it cannot be inferred).

Input iterator (required):

  • reference dereference() const
  • void increment()

Forward:

  • bool equals(T|sentinel) const

Bidirectional:

  • void decrement()

Random access:

  • difference_type distance_to(T|sized_sentinel) const (can replace equal)
  • void advance(difference_type) (can replace increment/decrement)

Public functions

auto operator*() const -> decltype(auto) constexpr noexcept(…)
Dereference operator.
auto operator->() const -> decltype(auto) constexpr noexcept(…)
Arrow operator.
template<detail::equality_comparable<self_type> T>
auto operator==(const self_type& lhs, const T& rhs) -> bool f constexpr noexcept(…)
Equality comparison operator, the default overload which requires Derived::equals(T) const
template<detail::has_distance_to<self_type> T>
auto operator==(const self_type& lhs, const T& rhs) -> bool f constexpr noexcept(…)
Fallback equality comparison operator when Derived::equals(T) const is not available, but Derived::distance_to(T) const is.
template<typename T = self_type>
auto operator++() -> self_type& constexpr noexcept(…)
Default pre-increment operator, requires Derived::increment()
template<typename T = self_type>
auto operator++() -> self_type& constexpr noexcept(…)
Fallback pre-increment operator when Derived::increment() is not available, requires Derived::advance(1) to be valid.
template<typename T = self_type>
auto operator++(int) -> self_type constexpr noexcept(…)
Post-increment operator, requires Derived::increment() or Derived::advance(1)
template<typename T = self_type>
auto operator--() -> self_type& constexpr noexcept(…)
Default pre-decrement operator, requires Derived::decrement()
template<typename T = self_type>
auto operator--() -> self_type& constexpr noexcept(…)
Fallback pre-decrement operator when Derived::decrement() is not available, requires Derived::advance(-1) to be valid.
template<typename T = self_type>
auto operator--(int) -> self_type constexpr noexcept(…)
Post-decrement operator, requires Derived::decrement() or Derived::advance(-1)
template<typename T = self_type, detail::advance_type_arg<T> D>
auto operator[](D off) const -> decltype(auto) constexpr noexcept(…)
Random access operator, requires Derived::advance()

Friends

template<detail::advance_type_arg<self_type> D>
auto operator+=(self_type& self, D offset) -> self_type& constexpr noexcept(…)
operator+=, requires Derived::advance()
template<detail::advance_type_arg<self_type> D>
auto operator+(self_type left, D off) -> self_type constexpr noexcept(…)
operator+, requires Derived::advance()
template<detail::advance_type_arg<self_type> D>
auto operator+(D off, self_type right) -> auto constexpr noexcept(…)
operator+, requires Derived::advance()
template<detail::advance_type_arg<self_type> D>
auto operator-(self_type left, D off) -> self_type constexpr noexcept(…)
operator-, requires Derived::advance()
template<detail::advance_type_arg<self_type> D>
auto operator-=(self_type& left, D off) -> self_type& constexpr noexcept(…)
operator-=, requires Derived::advance()
template<detail::has_distance_to<self_type> T>
auto operator-(const T& left, const self_type& right) -> decltype(auto) constexpr noexcept(…)
Distance between two iterators or iterator and sentinel pair, requires Derived::distance_to()
template<detail::has_distance_to<self_type> Sentinel>
auto operator-(const self_type& left, const Sentinel& right) -> decltype(auto) constexpr noexcept(…)
Distance between an iterator and a sentinel, requires Derived::distance_to()
template<detail::has_distance_to<self_type> Sentinel>
auto operator<=>(const self_type& left, const Sentinel& right) -> auto constexpr noexcept(…)
Three way comparison operator, requires Derived::distance_to()

Function documentation

template<typename Derived, bool Contiguous>
decltype(auto) slang::iterator_facade<Derived, Contiguous>::operator*() const constexpr noexcept(…)

Dereference operator.

Returns decltype(Derived{}.dereference())

template<typename Derived, bool Contiguous>
decltype(auto) slang::iterator_facade<Derived, Contiguous>::operator->() const constexpr noexcept(…)

Arrow operator.

Returns Pointer or arrow proxy to the return value of Derived::dereference() const