template<std::size_t size_, class T>
Corrade::Containers::StaticArray class

Compile-time-sized array.

Template parameters
size_ Array size
T Element type

Like Array, but with compile-time size information. Useful as a more featureful alternative to plain C arrays or std::array, especially when it comes to initialization. A non-owning version of this container is a StaticArrayView.

Usage

The StaticArray class provides an access and slicing API similar to Array, which in turn shares the basic workflow patterns with ArrayView, see its usage docs for details. The main difference is that StaticArray doesn't do any heap allocation and thus has no concept of a deleter, and it has additional compile-time-sized overloads of slice(), prefix(), suffix(), exceptPrefix() and exceptSuffix(), mirroring the APIs of StaticArrayView.

/* Create an array with 5 integers and set them to some value */
Containers::StaticArray<5, int> a;
int b = 0;
for(auto& i: a) i = b++;            // a == {0, 1, 2, 3, 4}

/* Create an array from given values */
Containers::StaticArray<4, int> c{3, 18, -157, 0};
c[3] = 25;                          // c == {3, 18, -157, 25}

Array initialization

The array is by default value-initialized, which means that trivial types are zero-initialized and the default constructor is called on other types. It is possible to initialize the array in a different way using so-called tags:

/* These two are equivalent */
Containers::StaticArray<5, int> a1;
Containers::StaticArray<5, int> a2{DefaultInit};

/* Array of 100 integers, uninitialized */
Containers::StaticArray<100, int> b{NoInit};

/* Array of 4 values initialized in-place. These two are equivalent. */
Containers::StaticArray<4, int> c1{3, 18, -157, 0};
Containers::StaticArray<4, int> c2{InPlaceInit, 3, 18, -157, 0};

/* Array of a type with no default constructor. All five elements will be
   initialized to {5.2f, 0.5f, 1.0f}. */
struct Vec3 {
    explicit Vec3(float, float, float) {}
};
Containers::StaticArray<5, Vec3> d{DirectInit, 5.2f, 0.4f, 1.0f};

Usage in constexpr contexts

In order to implement the StaticArray(NoInitT) constructor for arbitrary types, internally the data has to be a union array. That would however lose trivial copyability and possibility to use the type in constexpr contexts, so to solve that, types that have a trivial default constructor or a constructor taking Corrade::NoInitT use a specialized internal representation without a union. StaticArray of such types is then a constexpr type and is trivially copyable if the underlying type is trivially copyable.

Conversion to array views

Arrays are implicitly convertible to ArrayView / StaticArrayView as described in the following table. The conversion is only allowed if T* is implicitly convertible to U* (or both are the same type) and both have the same size. This also extends to other container types constructibe from ArrayView / StaticArrayView, which means for example that a StridedArrayView1D is implicitly convertible from StaticArray as well.

Owning array typeNon-owning view type
Array<size, T>ArrayView<size, U>
Array<size, T>ArrayView<size, const U>
const Array<size, T>ArrayView<size, const U>
Array<size, T>ArrayView<U>
Array<size, T>ArrayView<const U>
const Array<size, T>ArrayView<const U>

C++17 structured bindings

If Corrade/Containers/StructuredBindings.h is included, the class can be used in C++17 structured bindings. While the get<i>() overloads are defined inside StaticArray itself, a separate header is used for the std::tuple_size and std::tuple_element template specializations, as those may require #include <utility> on some STL implementations. Example:

#include <Corrade/Containers/StructuredBindings.h>



auto [a, b, c] = Containers::Array3<int>{7, 13, 29};

STL compatibility

On compilers that support C++2a and std::span, implicit conversion of an StaticArray to it is provided in Corrade/Containers/ArrayViewStlSpan.h. The conversion is provided in a separate header to avoid unconditional #include <span>, which significantly affects compile times. The following table lists allowed conversions:

Corrade typeSTL type
StaticArray<size, T>std::span<T, size>
StaticArray<size, T>std::span<const T, size>
const StaticArray<size, T>std::span<const T, size>

Public types

enum (anonymous): std::size_t { Size = size_ }
using Type = T
Element type.

Constructors, destructors, conversion operators

StaticArray(Corrade::DefaultInitT) explicit constexpr
Construct a default-initialized array.
StaticArray(Corrade::ValueInitT) explicit constexpr
Construct a value-initialized array.
StaticArray(Corrade::NoInitT) explicit
Construct an array without initializing its contents.
template<class ... Args>
StaticArray(Corrade::DirectInitT, Args && ... args) explicit
Construct a direct-initialized array.
template<class ... Args>
StaticArray(Corrade::InPlaceInitT, Args && ... args) explicit constexpr
Construct an in-place-initialized array.
StaticArray(Corrade::InPlaceInitT, const T(&data)[size_]) explicit constexpr new in Git master
In-place construct an array by copying the elements from a fixed-size array.
StaticArray(Corrade::InPlaceInitT, T( && data)[size_]) explicit constexpr new in Git master
In-place construct an array by moving the elements from a fixed-size array.
StaticArray() explicit constexpr
Construct a value-initialized array.
template<class ... Args>
StaticArray(Args && ... args) constexpr
Construct an in-place-initialized array.
StaticArray(const T(&data)[size_]) explicit constexpr new in Git master
In-place construct an array by copying the elements from a fixed-size array.
StaticArray(T( && data)[size_]) explicit constexpr new in Git master
In-place construct an array by moving the elements from a fixed-size array.
template<class U, class = decltype(Implementation::StaticArrayViewConverter<size_, T, U>::to(std::declval<StaticArrayView<size_, T>>()))>
operator U()
Convert to external view representation.
template<class U, class = decltype(Implementation::StaticArrayViewConverter<size_, const T, U>::to(std::declval<StaticArrayView<size_, const T>>()))>
operator U() const constexpr
operator bool() const explicit constexpr
Whether the array is non-empty.
operator T*() &
Conversion to array type.
operator const T*() const & constexpr

Public functions

auto data() -> T*
Array data.
auto data() const -> const T* constexpr
auto size() const -> std::size_t constexpr
Array size.
auto isEmpty() const -> bool constexpr new in Git master
Whether the array is empty.
auto empty() const -> bool deprecated in Git master constexpr
Whether the array is empty.
auto begin() -> T*
Pointer to the first element.
auto begin() const -> const T* constexpr
auto cbegin() const -> const T* constexpr
auto end() -> T*
Pointer to (one item after) the last element.
auto end() const -> const T* constexpr
auto cend() const -> const T* constexpr
auto front() -> T&
First element.
auto front() const -> const T& constexpr
auto back() -> T&
Last element.
auto back() const -> const T& constexpr
auto operator[](std::size_t i) -> T& new in Git master
Element access.
auto operator[](std::size_t i) const -> const T& constexpr new in Git master
auto slice(T* begin, T* end) -> ArrayView<T>
View on a slice.
auto slice(const T* begin, const T* end) const -> ArrayView<const T> constexpr
auto slice(std::size_t begin, std::size_t end) -> ArrayView<T>
auto slice(std::size_t begin, std::size_t end) const -> ArrayView<const T> constexpr
auto sliceSize(T* begin, std::size_t size) -> ArrayView<T> new in Git master
View on a slice of given size.
auto sliceSize(const T* begin, std::size_t size) const -> ArrayView<const T> constexpr new in Git master
auto sliceSize(std::size_t begin, std::size_t size) -> ArrayView<T> new in Git master
auto sliceSize(std::size_t begin, std::size_t size) const -> ArrayView<const T> constexpr new in Git master
template<std::size_t size__>
auto slice(T* begin) -> StaticArrayView<size__, T>
Fixed-size view on a slice.
template<std::size_t size__>
auto slice(const T* begin) const -> StaticArrayView<size__, const T> constexpr
template<std::size_t size__>
auto slice(std::size_t begin) -> StaticArrayView<size__, T>
template<std::size_t size__>
auto slice(std::size_t begin) const -> StaticArrayView<size__, const T> constexpr
template<std::size_t begin_, std::size_t end_>
auto slice() -> StaticArrayView<end_ - begin_, T> new in 2019.10
Fixed-size view on a slice.
template<std::size_t begin_, std::size_t end_>
auto slice() const -> StaticArrayView<end_ - begin_, const T> constexpr new in 2019.10
template<std::size_t begin_, std::size_t size__>
auto sliceSize() -> StaticArrayView<size__, T> new in Git master
Fixed-size view on a slice of given size.
template<std::size_t begin_, std::size_t size__>
auto sliceSize() const -> StaticArrayView<size__, const T> constexpr new in Git master
auto prefix(T* end) -> ArrayView<T>
View on a prefix until a pointer.
auto prefix(const T* end) const -> ArrayView<const T> constexpr
auto suffix(T* begin) -> ArrayView<T>
View on a suffix after a pointer.
auto suffix(const T* begin) const -> ArrayView<const T> constexpr
auto prefix(std::size_t size) -> ArrayView<T>
View on the first size items.
auto prefix(std::size_t size) const -> ArrayView<const T> constexpr
template<std::size_t size__>
auto prefix() -> StaticArrayView<size__, T>
Fixed-size view on the first size__ items.
template<std::size_t size__>
auto prefix() const -> StaticArrayView<size__, const T> constexpr
auto exceptPrefix(std::size_t size) -> ArrayView<T> new in Git master
View except the first size items.
auto exceptPrefix(std::size_t size) const -> ArrayView<const T> constexpr new in Git master
auto suffix(std::size_t begin) -> ArrayView<T> deprecated in Git master
Fixed-size view except the first size__ items.
auto suffix(std::size_t begin) const -> ArrayView<const T> deprecated in Git master
Fixed-size view except the first size__ items.
template<std::size_t size__>
auto exceptPrefix() -> StaticArrayView<size_ - size__, T> new in Git master
Fixed-size view except the first size__ items.
template<std::size_t size__>
auto exceptPrefix() const -> StaticArrayView<size_ - size__, const T> constexpr new in Git master
template<std::size_t begin_>
auto suffix() -> StaticArrayView<size_ - begin_, T> deprecated in Git master
Fixed-size view except the first size__ items.
template<std::size_t begin_>
auto suffix() const -> StaticArrayView<size_ - begin_, const T> deprecated in Git master
Fixed-size view except the first size__ items.
auto exceptSuffix(std::size_t size) -> ArrayView<T> new in Git master
View except the last size items.
auto exceptSuffix(std::size_t size) const -> ArrayView<const T> constexpr new in Git master
auto except(std::size_t count) -> ArrayView<T> deprecated in Git master
Fixed-size view except the last size__ items.
auto except(std::size_t count) const -> ArrayView<const T> deprecated in Git master
template<std::size_t size__>
auto exceptSuffix() -> StaticArrayView<size_ - size__, T> new in Git master
Fixed-size view except the last size__ items.
template<std::size_t size__>
auto exceptSuffix() const -> StaticArrayView<size_ - size__, const T> constexpr new in Git master
template<std::size_t count>
auto except() -> StaticArrayView<size_ - count, T> deprecated in Git master
Fixed-size view except the last size__ items.
template<std::size_t count>
auto except() const -> StaticArrayView<size_ - count, const T> deprecated in Git master

Enum documentation

template<std::size_t size_, class T>
enum Corrade::Containers::StaticArray<size_, T>::(anonymous): std::size_t

Enumerators
Size

Array size

Function documentation

template<std::size_t size_, class T>
Corrade::Containers::StaticArray<size_, T>::StaticArray(Corrade::DefaultInitT) explicit constexpr

Construct a default-initialized array.

Creates array of given size, the contents are default-initialized (i.e., trivial types are not initialized). Because of the differing behavior for trivial types it's better to explicitly use either the StaticArray(ValueInitT) or the StaticArray(NoInitT) variant instead.

template<std::size_t size_, class T>
Corrade::Containers::StaticArray<size_, T>::StaticArray(Corrade::ValueInitT) explicit constexpr

Construct a value-initialized array.

Creates array of given size, the contents are value-initialized (i.e., trivial types are zero-initialized, default constructor called otherwise). This is the same as StaticArray().

template<std::size_t size_, class T>
Corrade::Containers::StaticArray<size_, T>::StaticArray(Corrade::NoInitT) explicit

Construct an array without initializing its contents.

Creates array of given size, the contents are not initialized. Useful if you will be overwriting all elements later anyway or if you need to call custom constructors in a way that's not expressible via any other StaticArray constructor.

For trivial types is equivalent to StaticArray(DefaultInitT). For non-trivial types, the class will explicitly call the destructor on all elements — which means that for non-trivial types you're expected to construct all elements using placement new (or for example std::uninitialized_copy()) in order to avoid calling destructors on uninitialized memory:

struct Foo {
    explicit Foo(int) {}
};

Containers::StaticArray<5, Foo> e{NoInit};

int index = 0;
for(Foo& f: e) new(&f) Foo{index++};

template<std::size_t size_, class T> template<class ... Args>
Corrade::Containers::StaticArray<size_, T>::StaticArray(Corrade::DirectInitT, Args && ... args) explicit

Construct a direct-initialized array.

Constructs the array using the StaticArray(NoInitT) constructor and then initializes each element with placement new using forwarded args.

template<std::size_t size_, class T> template<class ... Args>
Corrade::Containers::StaticArray<size_, T>::StaticArray(Corrade::InPlaceInitT, Args && ... args) explicit constexpr

Construct an in-place-initialized array.

The arguments are forwarded to the array constructor. Note that the variadic template means you can't use {} for nested type initializers — see StaticArray(InPlaceInitT, const T(&)[size_]) or StaticArray(InPlaceInitT, T(&&)[size_]) for an alternative. Same as StaticArray(Args&&... args).

template<std::size_t size_, class T>
Corrade::Containers::StaticArray<size_, T>::StaticArray(Corrade::InPlaceInitT, const T(&data)[size_]) explicit constexpr new in Git master

In-place construct an array by copying the elements from a fixed-size array.

Compared to StaticArray(InPlaceInitT, Args&&... args) doesn't require the elements to have explicitly specified type. The array elements are copied to the array constructor, if you have a non-copyable type or want to move the elements, use StaticArray(InPlaceInitT, T(&&)[size_]) instead. Same as StaticArray(const T(&)[size_]).

template<std::size_t size_, class T>
Corrade::Containers::StaticArray<size_, T>::StaticArray(Corrade::InPlaceInitT, T( && data)[size_]) explicit constexpr new in Git master

In-place construct an array by moving the elements from a fixed-size array.

Compared to StaticArray(InPlaceInitT, Args&&... args) doesn't require the elements to have explicitly specified type. Same as StaticArray(T(&&)[size_]).

template<std::size_t size_, class T>
Corrade::Containers::StaticArray<size_, T>::StaticArray() explicit constexpr

Construct a value-initialized array.

Alias to StaticArray(ValueInitT).

template<std::size_t size_, class T> template<class ... Args>
Corrade::Containers::StaticArray<size_, T>::StaticArray(Args && ... args) constexpr

Construct an in-place-initialized array.

Alias to StaticArray(InPlaceInitT, Args&&... args).

template<std::size_t size_, class T>
Corrade::Containers::StaticArray<size_, T>::StaticArray(const T(&data)[size_]) explicit constexpr new in Git master

In-place construct an array by copying the elements from a fixed-size array.

Alias to StaticArray(InPlaceInitT, const T(&)[size_]).

template<std::size_t size_, class T>
Corrade::Containers::StaticArray<size_, T>::StaticArray(T( && data)[size_]) explicit constexpr new in Git master

In-place construct an array by moving the elements from a fixed-size array.

Alias to StaticArray(InPlaceInitT, T(&&)[size_]).

template<std::size_t size_, class T> template<class U, class = decltype(Implementation::StaticArrayViewConverter<size_, T, U>::to(std::declval<StaticArrayView<size_, T>>()))>
Corrade::Containers::StaticArray<size_, T>::operator U()

Convert to external view representation.

template<std::size_t size_, class T> template<class U, class = decltype(Implementation::StaticArrayViewConverter<size_, const T, U>::to(std::declval<StaticArrayView<size_, const T>>()))>
Corrade::Containers::StaticArray<size_, T>::operator U() const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
Corrade::Containers::StaticArray<size_, T>::operator const T*() const & constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
const T* Corrade::Containers::StaticArray<size_, T>::data() const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
std::size_t Corrade::Containers::StaticArray<size_, T>::size() const constexpr

Array size.

Equivalent to Size.

template<std::size_t size_, class T>
bool Corrade::Containers::StaticArray<size_, T>::isEmpty() const constexpr new in Git master

Whether the array is empty.

Always true (it's not possible to create a zero-sized C array).

template<std::size_t size_, class T>
bool Corrade::Containers::StaticArray<size_, T>::empty() const constexpr

Whether the array is empty.

template<std::size_t size_, class T>
T* Corrade::Containers::StaticArray<size_, T>::begin()

Pointer to the first element.

template<std::size_t size_, class T>
const T* Corrade::Containers::StaticArray<size_, T>::begin() const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
const T* Corrade::Containers::StaticArray<size_, T>::cbegin() const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
T* Corrade::Containers::StaticArray<size_, T>::end()

Pointer to (one item after) the last element.

template<std::size_t size_, class T>
const T* Corrade::Containers::StaticArray<size_, T>::end() const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
const T* Corrade::Containers::StaticArray<size_, T>::cend() const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
T& Corrade::Containers::StaticArray<size_, T>::front()

First element.

template<std::size_t size_, class T>
const T& Corrade::Containers::StaticArray<size_, T>::front() const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
T& Corrade::Containers::StaticArray<size_, T>::back()

Last element.

template<std::size_t size_, class T>
const T& Corrade::Containers::StaticArray<size_, T>::back() const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
T& Corrade::Containers::StaticArray<size_, T>::operator[](std::size_t i) new in Git master

Element access.

Expects that i is less than size().

template<std::size_t size_, class T>
const T& Corrade::Containers::StaticArray<size_, T>::operator[](std::size_t i) const constexpr new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
ArrayView<T> Corrade::Containers::StaticArray<size_, T>::slice(T* begin, T* end)

View on a slice.

Equivalent to StaticArrayView::slice(T*, T*) const and overloads.

template<std::size_t size_, class T>
ArrayView<const T> Corrade::Containers::StaticArray<size_, T>::slice(const T* begin, const T* end) const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
ArrayView<T> Corrade::Containers::StaticArray<size_, T>::slice(std::size_t begin, std::size_t end)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
ArrayView<const T> Corrade::Containers::StaticArray<size_, T>::slice(std::size_t begin, std::size_t end) const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
ArrayView<T> Corrade::Containers::StaticArray<size_, T>::sliceSize(T* begin, std::size_t size) new in Git master

View on a slice of given size.

Equivalent to StaticArrayView::sliceSize(T*, std::size_t) const and overloads.

template<std::size_t size_, class T>
ArrayView<const T> Corrade::Containers::StaticArray<size_, T>::sliceSize(const T* begin, std::size_t size) const constexpr new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
ArrayView<T> Corrade::Containers::StaticArray<size_, T>::sliceSize(std::size_t begin, std::size_t size) new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
ArrayView<const T> Corrade::Containers::StaticArray<size_, T>::sliceSize(std::size_t begin, std::size_t size) const constexpr new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T> template<std::size_t size__>
StaticArrayView<size__, T> Corrade::Containers::StaticArray<size_, T>::slice(T* begin)

Fixed-size view on a slice.

Equivalent to StaticArrayView::slice(T*) const and overloads.

template<std::size_t size_, class T> template<std::size_t size__>
StaticArrayView<size__, const T> Corrade::Containers::StaticArray<size_, T>::slice(const T* begin) const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T> template<std::size_t size__>
StaticArrayView<size__, T> Corrade::Containers::StaticArray<size_, T>::slice(std::size_t begin)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T> template<std::size_t size__>
StaticArrayView<size__, const T> Corrade::Containers::StaticArray<size_, T>::slice(std::size_t begin) const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T> template<std::size_t begin_, std::size_t end_>
StaticArrayView<end_ - begin_, T> Corrade::Containers::StaticArray<size_, T>::slice() new in 2019.10

Fixed-size view on a slice.

Equivalent to StaticArrayView::slice() const.

template<std::size_t size_, class T> template<std::size_t begin_, std::size_t end_>
StaticArrayView<end_ - begin_, const T> Corrade::Containers::StaticArray<size_, T>::slice() const constexpr new in 2019.10

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T> template<std::size_t begin_, std::size_t size__>
StaticArrayView<size__, T> Corrade::Containers::StaticArray<size_, T>::sliceSize() new in Git master

Fixed-size view on a slice of given size.

Equivalent to StaticArrayView::sliceSize() const.

template<std::size_t size_, class T> template<std::size_t begin_, std::size_t size__>
StaticArrayView<size__, const T> Corrade::Containers::StaticArray<size_, T>::sliceSize() const constexpr new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
ArrayView<T> Corrade::Containers::StaticArray<size_, T>::prefix(T* end)

View on a prefix until a pointer.

Equivalent to StaticArrayView::prefix(T*) const.

template<std::size_t size_, class T>
ArrayView<const T> Corrade::Containers::StaticArray<size_, T>::prefix(const T* end) const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
ArrayView<T> Corrade::Containers::StaticArray<size_, T>::suffix(T* begin)

View on a suffix after a pointer.

Equivalent to StaticArrayView::suffix(T*) const.

template<std::size_t size_, class T>
ArrayView<const T> Corrade::Containers::StaticArray<size_, T>::suffix(const T* begin) const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
ArrayView<T> Corrade::Containers::StaticArray<size_, T>::prefix(std::size_t size)

View on the first size items.

Equivalent to StaticArrayView::prefix(std::size_t) const.

template<std::size_t size_, class T>
ArrayView<const T> Corrade::Containers::StaticArray<size_, T>::prefix(std::size_t size) const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T> template<std::size_t size__>
StaticArrayView<size__, T> Corrade::Containers::StaticArray<size_, T>::prefix()

Fixed-size view on the first size__ items.

Equivalent to StaticArrayView::prefix() const and overloads.

template<std::size_t size_, class T> template<std::size_t size__>
StaticArrayView<size__, const T> Corrade::Containers::StaticArray<size_, T>::prefix() const constexpr

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
ArrayView<T> Corrade::Containers::StaticArray<size_, T>::exceptPrefix(std::size_t size) new in Git master

View except the first size items.

Equivalent to StaticArrayView::exceptPrefix(std::size_t) const.

template<std::size_t size_, class T>
ArrayView<const T> Corrade::Containers::StaticArray<size_, T>::exceptPrefix(std::size_t size) const constexpr new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
ArrayView<T> Corrade::Containers::StaticArray<size_, T>::suffix(std::size_t begin)

Fixed-size view except the first size__ items.

template<std::size_t size_, class T>
ArrayView<const T> Corrade::Containers::StaticArray<size_, T>::suffix(std::size_t begin) const

Fixed-size view except the first size__ items.

template<std::size_t size_, class T> template<std::size_t size__>
StaticArrayView<size_ - size__, T> Corrade::Containers::StaticArray<size_, T>::exceptPrefix() new in Git master

Fixed-size view except the first size__ items.

Equivalent to StaticArrayView::exceptPrefix() const and overloads.

template<std::size_t size_, class T> template<std::size_t size__>
StaticArrayView<size_ - size__, const T> Corrade::Containers::StaticArray<size_, T>::exceptPrefix() const constexpr new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T> template<std::size_t begin_>
StaticArrayView<size_ - begin_, T> Corrade::Containers::StaticArray<size_, T>::suffix()

Fixed-size view except the first size__ items.

template<std::size_t size_, class T> template<std::size_t begin_>
StaticArrayView<size_ - begin_, const T> Corrade::Containers::StaticArray<size_, T>::suffix() const

Fixed-size view except the first size__ items.

template<std::size_t size_, class T>
ArrayView<T> Corrade::Containers::StaticArray<size_, T>::exceptSuffix(std::size_t size) new in Git master

View except the last size items.

Equivalent to StaticArrayView::exceptSuffix(std::size_t) const.

template<std::size_t size_, class T>
ArrayView<const T> Corrade::Containers::StaticArray<size_, T>::exceptSuffix(std::size_t size) const constexpr new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T>
ArrayView<T> Corrade::Containers::StaticArray<size_, T>::except(std::size_t count)

Fixed-size view except the last size__ items.

template<std::size_t size_, class T>
ArrayView<const T> Corrade::Containers::StaticArray<size_, T>::except(std::size_t count) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T> template<std::size_t size__>
StaticArrayView<size_ - size__, T> Corrade::Containers::StaticArray<size_, T>::exceptSuffix() new in Git master

Fixed-size view except the last size__ items.

Equivalent to StaticArrayView::exceptSuffix() const.

template<std::size_t size_, class T> template<std::size_t size__>
StaticArrayView<size_ - size__, const T> Corrade::Containers::StaticArray<size_, T>::exceptSuffix() const constexpr new in Git master

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T> template<std::size_t count>
StaticArrayView<size_ - count, T> Corrade::Containers::StaticArray<size_, T>::except()

Fixed-size view except the last size__ items.

template<std::size_t size_, class T> template<std::size_t count>
StaticArrayView<size_ - count, const T> Corrade::Containers::StaticArray<size_, T>::except() const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

template<std::size_t size_, class T> template<std::size_t size, class T>
ArrayView<T> arrayView(StaticArray<size, T>& array) constexpr

Make a view on a StaticArray.

Convenience alternative to converting to an ArrayView explicitly. The following two lines are equivalent:

Containers::StaticArray<5, int> data;

Containers::ArrayView<int> a{data};
auto b = Containers::arrayView(data);

template<std::size_t size_, class T> template<std::size_t size, class T>
ArrayView<const T> arrayView(const StaticArray<size, T>& array) constexpr

Make a view on a const StaticArray.

Convenience alternative to converting to an ArrayView explicitly. The following two lines are equivalent:

const Containers::StaticArray<5, int> data;

Containers::ArrayView<const int> a{data};
auto b = Containers::arrayView(data);

template<std::size_t size_, class T> template<std::size_t size, class T>
StaticArrayView<size, T> staticArrayView(StaticArray<size, T>& array) constexpr

Make a static view on a StaticArray.

Convenience alternative to converting to an StaticArrayView explicitly. The following two lines are equivalent:

Containers::StaticArray<5, int> data;

Containers::StaticArrayView<5, int> a{data};
auto b = Containers::staticArrayView(data);

template<std::size_t size_, class T> template<std::size_t size, class T>
StaticArrayView<size, const T> staticArrayView(const StaticArray<size, T>& array) constexpr

Make a static view on a const StaticArray.

Convenience alternative to converting to an StaticArrayView explicitly. The following two lines are equivalent:

const Containers::StaticArray<5, int> data;

Containers::StaticArrayView<5, const int> a{data};
auto b = Containers::staticArrayView(data);

template<std::size_t size_, class T> template<class U, std::size_t size, class T>
StaticArrayView<size*sizeof(T)/sizeof(U), U> arrayCast(StaticArray<size, T>& array)

Reinterpret-cast a static array.

See arrayCast(StaticArrayView<size, T>) for more information.

template<std::size_t size_, class T> template<std::size_t size_, class T>
std::size_t arraySize(const StaticArray<size_, T>&) constexpr

Static array size.

See arraySize(ArrayView<T>) for more information.