Template Class MatrixView

Class Documentation

template<typename T, size_t Dimensions>
class MatrixView

A view into a strided multi-dimensional array.

This class is a work-in-progress.

Template Parameters
  • T – The type viewed by this object.

  • Dimensions – The number of dimensions of the view.

Public Types

using size_type = int
using shape_type = std::array<size_type, Dimensions>
using stride_type = std::array<size_type, Dimensions>
using index_type = std::array<size_type, Dimensions>
using reference = T&
using const_reference = const T&

Public Functions

constexpr MatrixView() = default

Default constructor.

inline constexpr MatrixView(const shape_type &shape_xy, const stride_type &strides_xy, T *data) noexcept

Create a new multi-dimensional view.

inline constexpr reference operator[](const index_type &index) noexcept

Get the item at index.

inline constexpr const_reference operator[](const index_type &index) const noexcept

Get the const item at index.

inline constexpr reference at(const index_type &index)

Get the item at index, checking bounds.

inline constexpr const_reference at(const index_type &index) const

Get the const item at index, checking bounds.

inline constexpr bool in_bounds(const index_type &index) const noexcept

Return true if index is within the bounds of this matrix.