template<>
Death::Containers::ArrayView<void> class

Void array view.

Specialization of ArrayView which is convertible from a compile-time array, Array, ArrayView or StaticArrayView of any non-constant type and also any non-constant 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<void>) to first cast the array to a concrete type and then access the particular elements.

Public types

using Type = void
Element type.

Constructors, destructors, conversion operators

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

Public functions

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

Function documentation

template<>
Death::Containers::ArrayView<void>::ArrayView(std::nullptr_t = nullptr) constexpr noexcept

Default constructor.

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

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

Construct a view on a type-erased array with explicit length.

Parameters
data Data pointer
size Data size in bytes

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

Construct a view on a typed array with explicit length.

Parameters
data Data pointer
size Data size

Size is recalculated to size in bytes.

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

Construct a view on a fixed-size array.

Parameters
data Fixed-size array

Size in bytes is calculated automatically.