# xiterable

Defined in `xtensor/xiterable.hpp`

template<class D>
class xconst_iterable

  Base class for multidimensional iterable constant expressions.

  The xconst_iterable class defines the interface for multidimensional constant expressions that can be iterated.

  Template Parameters:

    D – The derived type, i.e. the inheriting class for which xconst_iterable provides the interface.

  Subclassed by xt::xiterable< xarray_adaptor< EC, L, SC, Tag > >, xt::xiterable< xarray_container< EC, L, SC, Tag > >, xt::xiterable< xchunked_array< chunk_storage > >, xt::xiterable< xdynamic_view< CT, S, layout_type::dynamic, detail::flat_storage_getter< CT, ::xt::layout_type::row_major > > >, xt::xiterable< xfixed_adaptor< EC, S, L, SH, Tag > >, xt::xiterable< xfixed_container< ET, S, L, SH, Tag > >, xt::xiterable< xindex_view< CT, I > >, xt::xiterable< xmasked_view< CTD, CTM > >, xt::xiterable< xoptional_assembly< VE, FE > >, xt::xiterable< xoptional_assembly_adaptor< VEC, FEC > >, xt::xiterable< xscalar< CT > >, xt::xiterable< xtensor_adaptor< EC, N, L, Tag > >, xt::xiterable< xtensor_container< EC, N, L, Tag > >, xt::xiterable< xtensor_view< EC, N, L, Tag > >, xt::xiterable< D >

  Constant iterators

  template<layout_type L>
  inline auto begin() const noexcept -> const_layout_iterator<L>

    Returns a constant iterator to the first element of the expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto end() const noexcept -> const_layout_iterator<L>

    Returns a constant iterator to the element following the last element of the expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto cbegin() const noexcept -> const_layout_iterator<L>

    Returns a constant iterator to the first element of the expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto cend() const noexcept -> const_layout_iterator<L>

    Returns a constant iterator to the element following the last element of the expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  Constant reverse iterators

  template<layout_type L>
  inline auto rbegin() const noexcept -> const_reverse_layout_iterator<L>

    Returns a constant iterator to the first element of the reversed expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto rend() const noexcept -> const_reverse_layout_iterator<L>

    Returns a constant iterator to the element following the last element of the reversed expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto crbegin() const noexcept -> const_reverse_layout_iterator<L>

    Returns a constant iterator to the first element of the reversed expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto crend() const noexcept -> const_reverse_layout_iterator<L>

    Returns a constant iterator to the element following the last element of the reversed expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  Constant broadcast iterators

  template<layout_type L, class S>
  inline auto begin(const S &shape) const noexcept -> const_broadcast_iterator<S, L>

    Returns a constant iterator to the first element of the expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto end(const S &shape) const noexcept -> const_broadcast_iterator<S, L>

    Returns a constant iterator to the element following the last element of the expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto cbegin(const S &shape) const noexcept -> const_broadcast_iterator<S, L>

    Returns a constant iterator to the first element of the expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto cend(const S &shape) const noexcept -> const_broadcast_iterator<S, L>

    Returns a constant iterator to the element following the last element of the expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  Constant reverse broadcast iterators

  template<layout_type L, class S>
  inline auto rbegin(const S &shape) const noexcept -> const_reverse_broadcast_iterator<S, L>

    Returns a constant iterator to the first element of the reversed expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto rend(const S &shape) const noexcept -> const_reverse_broadcast_iterator<S, L>

    Returns a constant iterator to the element following the last element of the reversed expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto crbegin(const S &shape) const noexcept -> const_reverse_broadcast_iterator<S, L>

    Returns a constant iterator to the first element of the reversed expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto crend(const S &shape) const noexcept -> const_reverse_broadcast_iterator<S, L>

    Returns a constant iterator to the element following the last element of the reversed expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

template<class D>
class xiterable : public xt::xconst_iterable<D>

  Base class for multidimensional iterable expressions.

  The xiterable class defines the interface for multidimensional expressions that can be iterated.

  Template Parameters:

    D – The derived type, i.e. the inheriting class for which xiterable provides the interface.

  Subclassed by xt::xcontiguous_iterable< xarray_adaptor< EC, L, SC, Tag > >, xt::xcontiguous_iterable< xarray_container< EC, L, SC, Tag > >, xt::xcontiguous_iterable< xfixed_adaptor< EC, S, L, SH, Tag > >, xt::xcontiguous_iterable< xfixed_container< ET, S, L, SH, Tag > >, xt::xcontiguous_iterable< xtensor_adaptor< EC, N, L, Tag > >, xt::xcontiguous_iterable< xtensor_container< EC, N, L, Tag > >, xt::xcontiguous_iterable< xtensor_view< EC, N, L, Tag > >, xt::xoptional_assembly_base< xoptional_assembly< VE, FE > >, xt::xoptional_assembly_base< xoptional_assembly_adaptor< VEC, FEC > >, xt::xcontiguous_iterable< D >, xt::xdynamic_view< CT, S, L, FST >, xt::xoptional_assembly_base< D >

  Iterators

  template<layout_type L>
  inline auto begin() noexcept -> layout_iterator<L>

    Returns an iterator to the first element of the expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto end() noexcept -> layout_iterator<L>

    Returns an iterator to the element following the last element of the expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  Reverse iterators

  template<layout_type L>
  inline auto rbegin() noexcept -> reverse_layout_iterator<L>

    Returns an iterator to the first element of the reversed expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto rend() noexcept -> reverse_layout_iterator<L>

    Returns an iterator to the element following the last element of the reversed expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  Broadcast iterators

  template<layout_type L, class S>
  inline auto begin(const S &shape) noexcept -> broadcast_iterator<S, L>

    Returns an iterator to the first element of the expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto end(const S &shape) noexcept -> broadcast_iterator<S, L>

    Returns an iterator to the element following the last element of the expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  Reverse broadcast iterators

  template<layout_type L, class S>
  inline auto rbegin(const S &shape) noexcept -> reverse_broadcast_iterator<S, L>

    Returns an iterator to the first element of the reversed expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto rend(const S &shape) noexcept -> reverse_broadcast_iterator<S, L>

    Returns an iterator to the element following the last element of the reversed expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  Public Functions

  template<layout_type L>
  inline auto begin() const noexcept -> const_layout_iterator<L>

    Returns a constant iterator to the first element of the expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto begin(const S &shape) const noexcept -> const_broadcast_iterator<S, L>

    Returns a constant iterator to the first element of the expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto end() const noexcept -> const_layout_iterator<L>

    Returns a constant iterator to the element following the last element of the expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto end(const S &shape) const noexcept -> const_broadcast_iterator<S, L>

    Returns a constant iterator to the element following the last element of the expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto rbegin() const noexcept -> const_reverse_layout_iterator<L>

    Returns a constant iterator to the first element of the reversed expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto rbegin(const S &shape) const noexcept -> const_reverse_broadcast_iterator<S, L>

    Returns a constant iterator to the first element of the reversed expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto rend() const noexcept -> const_reverse_layout_iterator<L>

    Returns a constant iterator to the element following the last element of the reversed expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto rend(const S &shape) const noexcept -> const_reverse_broadcast_iterator<S, L>

    Returns a constant iterator to the element following the last element of the reversed expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

template<class D>
class xcontiguous_iterable : private xt::xiterable<D>

  Base class for multidimensional iterable expressions with contiguous storage.

  The xcontiguous_iterable class defines the interface for multidimensional expressions with contiguous that can be iterated.

  Template Parameters:

    D – The derived type, i.e. the inheriting class for which xcontiguous_iterable provides the interface.

  Subclassed by xt::xcontainer< xarray_adaptor< EC, L, SC, Tag > >, xt::xcontainer< xarray_container< EC, L, SC, Tag > >, xt::xcontainer< xfixed_adaptor< EC, S, L, SH, Tag > >, xt::xcontainer< xfixed_container< ET, S, L, SH, Tag > >, xt::xcontainer< xtensor_adaptor< EC, N, L, Tag > >, xt::xcontainer< xtensor_container< EC, N, L, Tag > >, xt::xcontainer< xtensor_view< EC, N, L, Tag > >, xt::xcontainer< D >

  Iterators

  template<layout_type L>
  inline auto begin() noexcept -> select_iterator<L>

    Returns an iterator to the first element of the expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto end() noexcept -> select_iterator<L>

    Returns an iterator to the element following the last element of the expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto begin() const noexcept -> select_const_iterator<L>

    Returns a constant iterator to the first element of the expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto end() const noexcept -> select_const_iterator<L>

    Returns a constant iterator to the element following the last element of the expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto cbegin() const noexcept -> select_const_iterator<L>

    Returns a constant iterator to the first element of the expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto cend() const noexcept -> select_const_iterator<L>

    Returns a constant iterator to the element following the last element of the expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  Reverse iterators

  template<layout_type L>
  inline auto rbegin() noexcept -> select_reverse_iterator<L>

    Returns an iterator to the first element of the reversed expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto rend() noexcept -> select_reverse_iterator<L>

    Returns an iterator to the element following the last element of the reversed expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto rbegin() const noexcept -> select_const_reverse_iterator<L>

    Returns a constant iterator to the first element of the reversed expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto rend() const noexcept -> select_const_reverse_iterator<L>

    Returns a constant iterator to the element following the last element of the reversed expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto crbegin() const noexcept -> select_const_reverse_iterator<L>

    Returns a constant iterator to the first element of the reversed expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L>
  inline auto crend() const noexcept -> select_const_reverse_iterator<L>

    Returns a constant iterator to the element following the last element of the reversed expression.

    Template Parameters:

      L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  Broadcast iterators

  template<layout_type L, class S>
  inline auto begin(const S &shape) noexcept -> broadcast_iterator<S, L>

    Returns an iterator to the first element of the expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto end(const S &shape) noexcept -> broadcast_iterator<S, L>

    Returns an iterator to the element following the last element of the expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto begin(const S &shape) const noexcept -> const_broadcast_iterator<S, L>

    Returns a constant iterator to the first element of the expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto end(const S &shape) const noexcept -> const_broadcast_iterator<S, L>

    Returns a constant iterator to the element following the last element of the expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto cbegin(const S &shape) const noexcept -> const_broadcast_iterator<S, L>

    Returns a constant iterator to the first element of the expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto cend(const S &shape) const noexcept -> const_broadcast_iterator<S, L>

    Returns a constant iterator to the element following the last element of the expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  Reverse broadcast iterators

  template<layout_type L, class S>
  inline auto rbegin(const S &shape) noexcept -> reverse_broadcast_iterator<S, L>

    Returns an iterator to the first element of the reversed expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto rend(const S &shape) noexcept -> reverse_broadcast_iterator<S, L>

    Returns an iterator to the element following the last element of the reversed expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto rbegin(const S &shape) const noexcept -> const_reverse_broadcast_iterator<S, L>

    Returns a constant iterator to the first element of the reversed expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto rend(const S &shape) const noexcept -> const_reverse_broadcast_iterator<S, L>

    Returns a constant iterator to the element following the last element of the reversed expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto crbegin(const S &shape) const noexcept -> const_reverse_broadcast_iterator<S, L>

    Returns a constant iterator to the first element of the reversed expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.

  template<layout_type L, class S>
  inline auto crend(const S &shape) const noexcept -> const_reverse_broadcast_iterator<S, L>

    Returns a constant iterator to the element following the last element of the reversed expression.

    The iteration is broadcasted to the specified shape.

    Parameters:

      shape – the shape used for broadcasting

    Template Parameters:

      - S – type of the `shape` parameter.

      - L – order used for the traversal. Default value is `XTENSOR_DEFAULT_TRAVERSAL`.