template<>
Corrade::Containers::ArrayView<const void> class

Constant void array view with size information.

Specialization of ArrayView which is convertible from a compile-time array, Array, ArrayView or StaticArrayView of any type and also any type convertible to them. Size for a particular type is recalculated to a size in bytes. This specialization doesn't provide any accessors besides data(), because it has no use for the void type. Instead, use arrayCast(ArrayView<T>) to first cast the array to a concrete type and then access the particular elements.

Usage example:

Containers::Array<int> a(5);

Containers::ArrayView<void> b(a); // b.size() == 20

Public types

using Type = const void
Element type.

Constructors, destructors, conversion operators

ArrayView(std::nullptr_t) constexpr noexcept
Conversion from nullptr
ArrayView() constexpr noexcept
Default constructor.
ArrayView(const void* data, std::size_t size) constexpr noexcept
Construct a view on array of explicit length.
template<class T>
ArrayView(const T* data, std::size_t size) constexpr noexcept
Constructor from any type.
template<class T, std::size_t size>
ArrayView(T(&data)[size]) constexpr noexcept
Construct a view on fixed-size array.
template<class T>
ArrayView(ArrayView<T> array) constexpr noexcept
Construct const void view on any ArrayView.
template<std::size_t size, class T>
ArrayView(const StaticArrayView<size, T>& array) constexpr noexcept
Construct const void view on any StaticArrayView.
template<class T, class = decltype(Implementation::ErasedArrayViewConverter<const T>::from(std::declval<const T&>()))>
ArrayView(const T& other) constexpr noexcept
Construct a view on an external type.
operator bool() const explicit constexpr
Whether the array is non-empty.
operator const void*() const constexpr
Conversion to array type.

Public functions

auto data() const -> const void* constexpr
Array data.
auto size() const -> std::size_t constexpr
Array size.
auto empty() const -> bool constexpr
Whether the array is empty.

Function documentation

template<>
Corrade::Containers::ArrayView<const void>::ArrayView() constexpr noexcept

Default constructor.

Creates zero-sized array. Move array with nonzero size onto the instance to make it useful.

template<>
Corrade::Containers::ArrayView<const void>::ArrayView(const void* data, std::size_t size) constexpr noexcept

Construct a view on array of explicit length.

Parameters
data Data pointer
size Data size

template<> template<class T>
Corrade::Containers::ArrayView<const void>::ArrayView(const T* data, std::size_t size) constexpr noexcept

Constructor from any type.

Parameters
data Data pointer
size Data size

Size is recalculated to size in bytes.

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

Construct a view on fixed-size array.

Parameters
data Fixed-size array

Size in bytes is calculated automatically.

template<> template<class T, class = decltype(Implementation::ErasedArrayViewConverter<const T>::from(std::declval<const T&>()))>
Corrade::Containers::ArrayView<const void>::ArrayView(const T& other) constexpr noexcept

Construct a view on an external type.