template<unsigned dimensions>
Corrade::Containers::StridedArrayView<dimensions, void> class new in Git master

Multi-dimensional 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 non-constant type and also any non-constant 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, void>&) to first cast the array to a concrete type and then access the particular elements.

Public types

enum (anonymous): unsigned { Dimensions = dimensions }
using Type = void
Underlying type.
using ErasedType = void
Erased type.
using Size = StridedDimensions<dimensions, std::size_t>
Size values.
using Stride = StridedDimensions<dimensions, std::ptrdiff_t>
Stride values.

Constructors, destructors, conversion operators

StridedArrayView(std::nullptr_t) constexpr noexcept
Conversion from nullptr
StridedArrayView() constexpr noexcept
Default constructor.
StridedArrayView(Containers::ArrayView<void> data, void* member, const Size& size, const Stride& stride) constexpr noexcept
Construct a view with explicit size and stride.
StridedArrayView(Containers::ArrayView<void> data, const Size& size, const Stride& stride) constexpr noexcept
Construct a view with explicit size and stride.
template<class T, std::size_t size>
StridedArrayView(T(&data)[size]) constexpr noexcept
Construct a void view on a fixed-size array.
template<class T>
StridedArrayView(StridedArrayView<dimensions, T> view) constexpr noexcept
Construct a void view on any StridedArrayView.
template<class T>
StridedArrayView(ArrayView<T> view) constexpr noexcept
Construct a void view on any ArrayView.
template<std::size_t size, class T>
StridedArrayView(StaticArrayView<size, T> view) constexpr noexcept
Construct a void view on any StaticArrayView.
template<class T, unsigned d = dimensions, class = typename std::enable_if<d == 1, decltype(Implementation::ErasedArrayViewConverter<typename std::decay<T && >::type>::from(std::declval<T && >()))>::type>
StridedArrayView(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 -> void* constexpr
Array data.
auto size() const -> std::conditional<dimensions==1, std::size_t, const Size&>::type constexpr
Array size.
auto stride() const -> std::conditional<dimensions==1, std::ptrdiff_t, const Stride&>::type constexpr
Array stride.
auto empty() const -> StridedDimensions<dimensions, bool> constexpr
Whether the array is empty.

Enum documentation

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

Enumerators
Dimensions

View dimensions

Typedef documentation

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

Underlying type.

Underlying data type. See also and ErasedType.

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

Erased type.

Equivalent to Type

Function documentation

template<unsigned dimensions>
Corrade::Containers::StridedArrayView<dimensions, void><dimensions>::StridedArrayView() constexpr noexcept

Default constructor.

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

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

Construct a view with explicit size and stride.

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

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

Construct a 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, void><dimensions>::StridedArrayView(ArrayView<T> view) constexpr noexcept

Construct a 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, void><dimensions>::StridedArrayView(StaticArrayView<size, T> view) constexpr noexcept

Construct a 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<typename std::decay<T && >::type>::from(std::declval<T && >()))>::type>
Corrade::Containers::StridedArrayView<dimensions, void><dimensions>::StridedArrayView(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 Size&>::type Corrade::Containers::StridedArrayView<dimensions, 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 Stride&>::type Corrade::Containers::StridedArrayView<dimensions, 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.