Template Class DataView

Nested Relationships

Class Documentation

template<typename T, size_t R>
class DataView

A multi-dimensional view for MemRef-like and std::vector<T> types.


A forward iterator is implemented in this view for traversing over the entire elements of MemRef types rank-by-rank starting from the last dimension (R-1). For example, The DataView iterator for MemRef<T, 2> starts from index (0, 0) and traverses elements in the following order: (0, 0), …, (0, sizes[1]-1), (1, 0), …, (1, sizes[1]-1), … (sizes[0]-1, sizes[1]-1).

Template Parameters
  • T – The underlying data type

  • R – The Rank (R > 0)

Public Functions

inline explicit DataView(std::vector<T> &buffer)
inline explicit DataView(T *_data_aligned, size_t _offset, size_t *_sizes, size_t *_strides)
inline auto size() const -> size_t
template<typename ...I>
inline T &operator()(I... idxs) const
inline iterator begin()
inline iterator end()
class iterator

Public Types

using iterator_category = std::forward_iterator_tag
using value_type = T
using difference_type = std::ptrdiff_t
using pointer = T*
using reference = T&

Public Functions

inline iterator(const DataView<T, R> &_view, int64_t begin_idx)
inline pointer operator->() const
inline reference operator*() const
inline iterator &operator++()
inline iterator operator++(int)
inline bool operator==(const iterator &other) const
inline bool operator!=(const iterator &other) const