xaxis_iterator

Defined in xtensor/xaxis_iterator.hpp

template<class CT>
class xaxis_iterator

Class for iteration over (N-1)-dimensional slices, where N is the dimension of the underlying expression.

If N is the number of dimensions of an expression, the xaxis_iterator iterates over (N-1)-dimensional slices oriented along the specified axis.

Template Parameters:

CT – the closure type of the xexpression

Constructors

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

Constructs an xaxis_iterator.

Parameters:
  • e – the expression to iterate over

  • axis – the axis to iterate over taking N-1 dimensional slices

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

Constructs an xaxis_iterator starting at specified index and offset.

Parameters:
  • e – the expression to iterate over

  • axis – the axis to iterate over taking N-1 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.

Param :

template<class CT>
inline bool xt::operator==(const xaxis_iterator<CT> &lhs, const xaxis_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_iterator<CT> &lhs, const xaxis_iterator<CT> &rhs)

Checks inequality of the iterators.

Returns:

true if the iterators are different, true otherwise

template<class E>
inline auto xt::axis_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_iterator

template<class E>
inline auto xt::axis_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_iterator

template<class E>
inline auto xt::axis_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_iterator

template<class E>
inline auto xt::axis_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 expression to iterate over

  • axis – the axis to iterate over

Returns:

an instance of xaxis_iterator