xtensor
Loading...
Searching...
No Matches
xt::xaxis_iterator< CT > Class Template Reference

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

#include <xaxis_iterator.hpp>

Public Types

using self_type = xaxis_iterator<CT>
 
using xexpression_type = std::decay_t<CT>
 
using size_type = typename xexpression_type::size_type
 
using difference_type = typename xexpression_type::difference_type
 
using shape_type = typename xexpression_type::shape_type
 
using value_type = xstrided_view<CT, shape_type>
 
using reference = std::remove_reference_t<apply_cv_t<CT, value_type>>
 
using pointer = xtl::xclosure_pointer<std::remove_reference_t<apply_cv_t<CT, value_type>>>
 
using iterator_category = std::forward_iterator_tag
 

Public Member Functions

Constructors
template<class CTA >
 xaxis_iterator (CTA &&e, size_type axis)
 Constructs an xaxis_iterator.
 
template<class CTA >
 xaxis_iterator (CTA &&e, size_type axis, size_type index, size_type offset)
 Constructs an xaxis_iterator starting at specified index and offset.
 
Increment
self_typeoperator++ ()
 Increments the iterator to the next position and returns it.
 
self_type operator++ (int)
 Makes a copy of the iterator, increments it to the next position, and returns the copy.
 
Reference
reference operator* () const
 Returns the strided view at the current iteration position.
 
pointer operator-> () const
 Returns a pointer to the strided view at the current iteration position.
 
bool equal (const self_type &rhs) const
 Checks equality of the xaxis_slice_iterator and rhs.
 

Detailed Description

template<class CT>
class xt::xaxis_iterator< CT >

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
CTthe closure type of the xexpression

Definition at line 33 of file xaxis_iterator.hpp.

Member Typedef Documentation

◆ difference_type

template<class CT >
using xt::xaxis_iterator< CT >::difference_type = typename xexpression_type::difference_type

Definition at line 41 of file xaxis_iterator.hpp.

◆ iterator_category

template<class CT >
using xt::xaxis_iterator< CT >::iterator_category = std::forward_iterator_tag

Definition at line 47 of file xaxis_iterator.hpp.

◆ pointer

template<class CT >
using xt::xaxis_iterator< CT >::pointer = xtl::xclosure_pointer<std::remove_reference_t<apply_cv_t<CT, value_type>>>

Definition at line 45 of file xaxis_iterator.hpp.

◆ reference

template<class CT >
using xt::xaxis_iterator< CT >::reference = std::remove_reference_t<apply_cv_t<CT, value_type>>

Definition at line 44 of file xaxis_iterator.hpp.

◆ self_type

template<class CT >
using xt::xaxis_iterator< CT >::self_type = xaxis_iterator<CT>

Definition at line 37 of file xaxis_iterator.hpp.

◆ shape_type

template<class CT >
using xt::xaxis_iterator< CT >::shape_type = typename xexpression_type::shape_type

Definition at line 42 of file xaxis_iterator.hpp.

◆ size_type

template<class CT >
using xt::xaxis_iterator< CT >::size_type = typename xexpression_type::size_type

Definition at line 40 of file xaxis_iterator.hpp.

◆ value_type

template<class CT >
using xt::xaxis_iterator< CT >::value_type = xstrided_view<CT, shape_type>

Definition at line 43 of file xaxis_iterator.hpp.

◆ xexpression_type

template<class CT >
using xt::xaxis_iterator< CT >::xexpression_type = std::decay_t<CT>

Definition at line 39 of file xaxis_iterator.hpp.

Constructor & Destructor Documentation

◆ xaxis_iterator() [1/2]

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

Constructs an xaxis_iterator.

Parameters
ethe expression to iterate over
axisthe axis to iterate over taking N-1 dimensional slices

Definition at line 152 of file xaxis_iterator.hpp.

◆ xaxis_iterator() [2/2]

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

Constructs an xaxis_iterator starting at specified index and offset.

Parameters
ethe expression to iterate over
axisthe axis to iterate over taking N-1 dimensional slices
indexthe starting index for the iterator
offsetthe starting offset for the iterator

Definition at line 167 of file xaxis_iterator.hpp.

Member Function Documentation

◆ equal()

template<class CT >
bool xt::xaxis_iterator< CT >::equal ( const self_type & rhs) const
inline

Checks equality of the xaxis_slice_iterator and rhs.

Parameters

return true if the iterators are equivalent, false otherwise

Definition at line 245 of file xaxis_iterator.hpp.

◆ operator*()

template<class CT >
auto xt::xaxis_iterator< CT >::operator* ( ) const
inline

Returns the strided view at the current iteration position.

Returns
a strided_view

Definition at line 216 of file xaxis_iterator.hpp.

◆ operator++() [1/2]

template<class CT >
auto xt::xaxis_iterator< CT >::operator++ ( )
inline

Increments the iterator to the next position and returns it.

Definition at line 185 of file xaxis_iterator.hpp.

◆ operator++() [2/2]

template<class CT >
auto xt::xaxis_iterator< CT >::operator++ ( int )
inline

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

Definition at line 197 of file xaxis_iterator.hpp.

◆ operator->()

template<class CT >
auto xt::xaxis_iterator< CT >::operator-> ( ) const
inline

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

Returns
a pointer to a strided_view

Definition at line 227 of file xaxis_iterator.hpp.


The documentation for this class was generated from the following file: