#include <Corrade/Containers/ArrayView.h>
template<>
ArrayView<void> class new in 2019.10
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. See ArrayView class docs for usage examples.
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::ArrayView(T(&data)[size]) constexpr noexcept
size_t size> - 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::ArrayView(const StaticArrayView<size, T>& array) constexpr noexcept
size_t size, class T> - Construct a void view on any StaticArrayView.
-
template<class T, class = decltype(Implementation::ErasedArrayViewConverter<typename std::ArrayView(T&& other) constexpr noexcept
decay<T && >::type>::from(std:: declval<T && >()))> - 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 isEmpty() const -> bool constexpr new in Git master
- Whether the view is empty.
- auto empty() const -> bool deprecated in Git master constexpr
- Whether the view is empty.
Function documentation
template<>
Corrade:: 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<>
Corrade:: 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>
Corrade:: 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>
Corrade:: 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.
template<>
template<class T, class = decltype(Implementation::ErasedArrayViewConverter<typename std:: decay<T && >::type>::from(std:: declval<T && >()))>
Corrade:: Containers:: ArrayView<void>:: ArrayView(T&& other) constexpr noexcept
Construct a view on an external type / from an external representation.
template<>
std:: size_t Corrade:: Containers:: ArrayView<void>:: size() const constexpr
View size.
template<>
bool Corrade:: Containers:: ArrayView<void>:: isEmpty() const constexpr new in Git master
Whether the view is empty.
template<>
bool Corrade:: Containers:: ArrayView<void>:: empty() const constexpr
Whether the view is empty.