xaccessible

Defined in xtensor/core/xaccessible.hpp

template<class D>
class xconst_accessible

Base class for implementation of common expression constant access methods.

The xaccessible class implements constant access methods common to all expressions.

Template Parameters:

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

Subclassed by xt::xaccessible< xscalar< CT > >, xt::xaccessible< xreducer< F, CT, X, O > >, xt::xaccessible< xmasked_view< CTD, CTM > >, xt::xaccessible< xchunked_array< chunk_storage > >, xt::xaccessible< xview< CT, S… > >, xt::xaccessible< D >

Public Functions

inline size_type size() const noexcept(noexcept(derived_cast().shape()))

Returns the size of the expression.

inline size_type dimension() const noexcept

Returns the number of dimensions of the expression.

inline size_type shape(size_type index) const

Returns the i-th dimension of the expression.

template<class ...Args>
inline bool in_bounds(Args... args) const

Returns true only if the the specified position is a valid entry in the expression.

Parameters:

args – a list of indices specifying the position in the expression.

Returns:

bool

inline const_reference front() const

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

inline const_reference back() const

Returns a constant reference to last the element of the expression.

template<class ...Args>
inline auto at(Args... args) const -> const_reference

Returns a constant reference to the element at the specified position in the expression, after dimension and bounds checking.

Parameters:

args – a list of indices specifying the position in the expression. Indices must be unsigned integers, the number of indices should be equal to the number of dimensions of the expression.

Throws:

std::out_of_range – if the number of argument is greater than the number of dimensions or if indices are out of bounds.

template<class S>
inline auto operator[](const S &index) const -> disable_integral_t<S, const_reference>

Returns a constant reference to the element at the specified position in the expression.

Parameters:

index – a sequence of indices specifying the position in the expression. Indices must be unsigned integers, the number of indices in the list should be equal or greater than the number of dimensions of the expression.

template<class ...Args>
inline auto periodic(Args... args) const -> const_reference

Returns a constant reference to the element at the specified position in the expression, after applying periodicity to the indices (negative and ‘overflowing’ indices are changed).

Parameters:

args – a list of indices specifying the position in the expression. Indices must be integers, the number of indices should be equal to the number of dimensions of the expression.

template<class D>
class xaccessible : public xt::xconst_accessible<D>

Base class for implementation of common expression access methods.

The xaccessible class implements access methods common to all expressions.

Template Parameters:

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

Subclassed by xt::xcontainer< xfixed_container< ET, S, L, SH, Tag > >, xt::xcontainer< xfixed_adaptor< EC, S, L, SH, Tag > >, xt::xfunctor_applier_base< xfunctor_adaptor< F, CT > >, xt::xfunctor_applier_base< xfunctor_view< F, CT > >, xt::xstrided_view_base< xstrided_view< CT, S, layout_type::dynamic, detail::flat_storage_getter< CT, ::xt::layout_type::row_major > > >, xt::xstrided_view_base< xdynamic_view< CT, S, layout_type::dynamic, detail::flat_storage_getter< CT, ::xt::layout_type::row_major > > >, xt::xcontainer< D >, xt::xfunctor_applier_base< D >, xt::xstrided_view_base< D >

Public Functions

inline reference front()

Returns a reference to the first element of the expression.

inline reference back()

Returns a reference to the last element of the expression.

template<class ...Args>
inline auto at(Args... args) -> reference

Returns a reference to the element at the specified position in the expression, after dimension and bounds checking.

Parameters:

args – a list of indices specifying the position in the expression. Indices must be unsigned integers, the number of indices should be equal to the number of dimensions of the expression.

Throws:

std::out_of_range – if the number of argument is greater than the number of dimensions or if indices are out of bounds.

template<class S>
inline auto operator[](const S &index) -> disable_integral_t<S, reference>

Returns a reference to the element at the specified position in the expression.

Parameters:

index – a sequence of indices specifying the position in the expression. Indices must be unsigned integers, the number of indices in the list should be equal or greater than the number of dimensions of the expression.

template<class ...Args>
inline auto periodic(Args... args) -> reference

Returns a reference to the element at the specified position in the expression, after applying periodicity to the indices (negative and ‘overflowing’ indices are changed).

Parameters:

args – a list of indices specifying the position in the expression. Indices must be integers, the number of indices should be equal to the number of dimensions of the expression.

template<class ...Args>
inline auto at(Args... args) const -> const_reference

Returns a constant reference to the element at the specified position in the expression, after dimension and bounds checking.

Parameters:

args – a list of indices specifying the position in the expression. Indices must be unsigned integers, the number of indices should be equal to the number of dimensions of the expression.

Throws:

std::out_of_range – if the number of argument is greater than the number of dimensions or if indices are out of bounds.

inline const_reference back() const

Returns a constant reference to last the element of the expression.

inline const_reference front() const

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

template<class ...Args>
inline auto periodic(Args... args) const -> const_reference

Returns a constant reference to the element at the specified position in the expression, after applying periodicity to the indices (negative and ‘overflowing’ indices are changed).

Parameters:

args – a list of indices specifying the position in the expression. Indices must be integers, the number of indices should be equal to the number of dimensions of the expression.