template<unsigned dimensions>
Corrade::Containers::StridedArrayView<dimensions, const void> class new in 2020.06

Multi-dimensional const void array view with size and stride information.

Specialization of StridedArrayView which is convertible from a compile-time array, Array, ArrayView, StaticArrayView or StridedArrayView of any type and also any type convertible to them. For arrays and non-strided views, size is taken as element count of the original array and stride becomes the original type size; for strided views the size and stride is taken as-is. This specialization doesn't provide any accessors besides data(), because it has no use for the void type. Instead, use arrayCast(const StridedArrayView<dimensions, const void>&) to first cast the array to a concrete type and then access the particular elements.

Public types

enum (anonymous): unsigned { Dimensions = dimensions }
using Size = Containers::Size<dimensions> deprecated in Git master
Size values.
using Stride = Containers::Stride<dimensions> deprecated in Git master
Stride values.

Constructors, destructors, conversion operators

StridedArrayView(std::nullptr_t = nullptr) constexpr noexcept
Default constructor.
StridedArrayView(ArrayView<const void> data, const void* member, const Containers::Size<dimensions>& size, const Containers::Stride<dimensions>& stride) constexpr noexcept
Construct a view with explicit size and stride.
StridedArrayView(ArrayView<const void> data, const Containers::Size<dimensions>& size, const Containers::Stride<dimensions>& stride) constexpr noexcept
Construct a view with explicit size and stride.
template<class T>
StridedArrayView(T* data, std::size_t size) constexpr noexcept new in Git master
Construct a const void view on an array with explicit length.
template<class T, std::size_t size>
StridedArrayView(T(&data)[size]) constexpr noexcept
Construct a const void view on a fixed-size array.
template<class T>
StridedArrayView(StridedArrayView<dimensions, T> view) constexpr noexcept
Construct a const void view on any StridedArrayView.
template<class T>
StridedArrayView(ArrayView<T> view) constexpr noexcept
Construct a const void view on any ArrayView.
template<std::size_t size, class T>
StridedArrayView(StaticArrayView<size, T> view) constexpr noexcept
Construct a const void view on any StaticArrayView.
template<class T, unsigned d = dimensions, class = typename std::enable_if<d == 1, decltype(Implementation::ErasedArrayViewConverter<const T>::from(std::declval<const T&>()))>::type>
StridedArrayView(const T& other) constexpr noexcept
Construct a view on an external type.
operator bool() const explicit constexpr
Whether the array is non-empty.

Public functions

auto data() const -> const void* constexpr
Array data.
auto size() const -> std::conditional<dimensions==1, std::size_t, const Containers::Size<dimensions>&>::type constexpr
Array size.
auto stride() const -> std::conditional<dimensions==1, std::ptrdiff_t, const Containers::Stride<dimensions>&>::type constexpr
Array stride.
auto isEmpty() const -> StridedDimensions<dimensions, bool> constexpr new in Git master
Whether the view is empty.
auto empty() const -> StridedDimensions<dimensions, bool> deprecated in Git master constexpr
Whether the view is empty.

Public variables

const typedef void Type
Underlying type.
const typedef void ErasedType
Erased type.

Enum documentation

template<unsigned dimensions>
enum Corrade::Containers::StridedArrayView<dimensions, const void><dimensions>::(anonymous): unsigned

Enumerators
Dimensions

View dimensions

Typedef documentation

template<unsigned dimensions>
typedef Containers::Size<dimensions> Corrade::Containers::StridedArrayView<dimensions, const void><dimensions>::Size

Size values.

template<unsigned dimensions>
typedef Containers::Stride<dimensions> Corrade::Containers::StridedArrayView<dimensions, const void><dimensions>::Stride

Stride values.

Function documentation

template<unsigned dimensions>
Corrade::Containers::StridedArrayView<dimensions, const void><dimensions>::StridedArrayView(std::nullptr_t = nullptr) constexpr noexcept

Default constructor.

Creates an empty nullptr view. Copy a non-empty Array, ArrayView or StridedArrayView onto the instance to make it useful.

template<unsigned dimensions>
Corrade::Containers::StridedArrayView<dimensions, const void><dimensions>::StridedArrayView(ArrayView<const void> data, const void* member, const Containers::Size<dimensions>& size, const Containers::Stride<dimensions>& stride) constexpr noexcept

Construct a view with explicit size and stride.

Parameters
data Continuous view on the data
member Pointer to the first member of the strided view
size Data size
stride Data stride

The data view is used only for a bounds check — expects that data size is enough for size and stride in the largest dimension if the stride is either positive or negative. Zero strides unfortunately can't be reliably checked for out-of-bounds conditions, so be extra careful when specifying these.

template<unsigned dimensions>
Corrade::Containers::StridedArrayView<dimensions, const void><dimensions>::StridedArrayView(ArrayView<const void> data, const Containers::Size<dimensions>& size, const Containers::Stride<dimensions>& stride) constexpr noexcept

Construct a view with explicit size and stride.

Equivalent to calling StridedArrayView(ArrayView<const void>, const void*, const Containers::Size<dimensions>&, const Containers::Stride<dimensions>&) with data as the first parameter and data.data() as the second parameter.

template<unsigned dimensions> template<class T>
Corrade::Containers::StridedArrayView<dimensions, const void><dimensions>::StridedArrayView(T* data, std::size_t size) constexpr noexcept new in Git master

Construct a const void view on an array with explicit length.

Parameters
data Data pointer
size Data size

Enabled only on one-dimensional views. Stride is implicitly set to sizeof(T).

template<unsigned dimensions> template<class T, std::size_t size>
Corrade::Containers::StridedArrayView<dimensions, const void><dimensions>::StridedArrayView(T(&data)[size]) constexpr noexcept

Construct a const void view on a fixed-size array.

Parameters
data Fixed-size array

Enabled only on one-dimensional views. Size is set to size, stride is to sizeof(T).

template<unsigned dimensions> template<class T>
Corrade::Containers::StridedArrayView<dimensions, const void><dimensions>::StridedArrayView(ArrayView<T> view) constexpr noexcept

Construct a const void view on any ArrayView.

Enabled only on one-dimensional views. Size is set to view's size, stride is to sizeof(T).

template<unsigned dimensions> template<std::size_t size, class T>
Corrade::Containers::StridedArrayView<dimensions, const void><dimensions>::StridedArrayView(StaticArrayView<size, T> view) constexpr noexcept

Construct a const void view on any StaticArrayView.

Enabled only on one-dimensional views. Size is set to view's size, stride is to sizeof(T).

template<unsigned dimensions> template<class T, unsigned d = dimensions, class = typename std::enable_if<d == 1, decltype(Implementation::ErasedArrayViewConverter<const T>::from(std::declval<const T&>()))>::type>
Corrade::Containers::StridedArrayView<dimensions, const void><dimensions>::StridedArrayView(const T& other) constexpr noexcept

Construct a view on an external type.

Enabled only on one-dimensional views.

template<unsigned dimensions>
std::conditional<dimensions==1, std::size_t, const Containers::Size<dimensions>&>::type Corrade::Containers::StridedArrayView<dimensions, const void><dimensions>::size() const constexpr

Array size.

Returns just std::size_t instead of Size for the one-dimensional case so the usual numeric operations work as expected. Explicitly cast to Size to ensure consistent behavior for all dimensions in generic implementations.

template<unsigned dimensions>
std::conditional<dimensions==1, std::ptrdiff_t, const Containers::Stride<dimensions>&>::type Corrade::Containers::StridedArrayView<dimensions, const void><dimensions>::stride() const constexpr

Array stride.

Returns just std::ptrdiff_t instead of Stride for the one-dimensional case so the usual numeric operations work as expected. Explicitly cast to Stride to ensure consistent behavior for all dimensions in generic implementations.

template<unsigned dimensions>
StridedDimensions<dimensions, bool> Corrade::Containers::StridedArrayView<dimensions, const void><dimensions>::isEmpty() const constexpr new in Git master

Whether the view is empty.

template<unsigned dimensions>
StridedDimensions<dimensions, bool> Corrade::Containers::StridedArrayView<dimensions, const void><dimensions>::empty() const constexpr

Whether the view is empty.

Variable documentation

template<unsigned dimensions>
const typedef void Corrade::Containers::StridedArrayView<dimensions, const void><dimensions>::Type

Underlying type.

Underlying data type. See also and ErasedType.

template<unsigned dimensions>
const typedef void Corrade::Containers::StridedArrayView<dimensions, const void><dimensions>::ErasedType

Erased type.

Equivalent to Type