# xaxis_slice_iterator

Defined in `xtensor/xaxis_slice_iterator.hpp`

template<class CT>
class xt::xaxis_slice_iterator

  Class for iteration over one-dimensional slices.

  The xaxis_slice_iterator iterates over one-dimensional slices oriented along the specified axis

  tparam CT

    the closure type of the xexpression

  Constructors

  template<class CTA>
  inline xaxis_slice_iterator(CTA &&e, size_type axis)

    Constructs an xaxis_slice_iterator.

    Parameters

      - e – the expression to iterate over

      - axis – the axis to iterate over taking one dimensional slices

  template<class CTA>
  inline xaxis_slice_iterator(CTA &&e, size_type axis, size_type index, size_type offset)

    Constructs an xaxis_slice_iterator starting at specified index and offset.

    Parameters

      - e – the expression to iterate over

      - axis – the axis to iterate over taking one dimensional slices

      - index – the starting index for the iterator

      - offset – the starting offset for the iterator

  Increment

  inline self_type &operator++()

    Increments the iterator to the next position and returns it.

  inline self_type operator++(int)

    Makes a copy of the iterator, increments it to the next position, and returns the copy.

  Reference

  inline reference operator*() const

    Returns the strided view at the current iteration position.

    Returns

      a strided_view

  inline pointer operator->() const

    Returns a pointer to the strided view at the current iteration position.

    Returns

      a pointer to a strided_view

  inline bool equal(const self_type &rhs) const

    Checks equality of the xaxis_slice_iterator and `rhs`.

    Returns

      true if the iterators are equivalent, false otherwise

template<class CT>
inline bool xt::operator==(const xaxis_slice_iterator<CT> &lhs, const xaxis_slice_iterator<CT> &rhs)

  Checks equality of the iterators.

  Returns

    true if the iterators are equivalent, false otherwise

template<class CT>
inline bool xt::operator!=(const xaxis_slice_iterator<CT> &lhs, const xaxis_slice_iterator<CT> &rhs)

  Checks inequality of the iterators.

  Returns

    true if the iterators are different, true otherwise

template<class E>
inline auto xt::axis_slice_begin(E &&e)

  Returns an iterator to the first element of the expression for axis 0.

  Parameters

    e – the expession to iterate over

  Returns

    an instance of xaxis_slice_iterator

template<class E>
inline auto xt::axis_slice_begin(E &&e, typename std::decay_t<E>::size_type axis)

  Returns an iterator to the first element of the expression for the specified axis.

  Parameters

    - e – the expession to iterate over

    - axis – the axis to iterate over

  Returns

    an instance of xaxis_slice_iterator

template<class E>
inline auto xt::axis_slice_end(E &&e)

  Returns an iterator to the element following the last element of the expression for axis 0.

  Parameters

    e – the expession to iterate over

  Returns

    an instance of xaxis_slice_iterator

template<class E>
inline auto xt::axis_slice_end(E &&e, typename std::decay_t<E>::size_type axis)

  Returns an iterator to the element following the last element of the expression for the specified axis.

  Parameters

    - e – the expession to iterate over

    - axis – the axis to iterate over

  Returns

    an instance of xaxis_slice_iterator