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:

  • StaticArray(DefaultInitT) leaves trivial types uninitialized and calls the default constructor elsewhere. In other words, T array[size]. Because of the differing behavior for trivial types it's better to explicitly use either the ValueInit or NoInit variants instead.
  • StaticArray(ValueInitT) is equivalent to the implicit parameterless constructor, zero-initializing trivial types and calling the default constructor elsewhere. Useful when you want to make the choice appear explicit. In other words, T array[size]{}.
  • StaticArray(DirectInitT, Args&&... args) constructs every element of the array using provided arguments. In other words, T array[size]{T{args...}, T{args...}, }.
  • StaticArray(InPlaceInitT, Args&&... args) is equivalent to StaticArray(Args&&... args), again useful when you want to make the choice appear explicit). In other words, T array[size]{args...}.
  • StaticArray(NoInitT) does not initialize anything. Useful for trivial types when you'll be overwriting the contents anyway, for non-trivial types this is the dangerous option and you need to call the constructor on all elements manually using placement new, std::uninitialized_copy() or similar — see the constructor docs for an example.
/* 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};

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>

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
Construct a default-initialized array.
StaticArray(Corrade::ValueInitT) explicit
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
Construct an in-place-initialized array.
StaticArray() explicit
Construct a value-initialized array.
template<class ... Args>
StaticArray(Args && ... args)
Construct an in-place-initialized array.
StaticArray(const StaticArray<size_, T>& other) noexcept(…)
Copy constructor.
StaticArray(StaticArray<size_, T>&& other) noexcept(…)
Move constructor.
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 T*() &
Conversion to array type.
operator const T*() const &

Public functions

auto operator=(const StaticArray<size_, T>&) -> StaticArray<size_, T>& noexcept(…)
Copy assignment.
auto operator=(StaticArray<size_, T>&&) -> StaticArray<size_, T>& noexcept(…)
Move assignment.
auto data() -> T*
Array data.
auto data() const -> const T*
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*
auto cbegin() const -> const T*
auto end() -> T*
Pointer to (one item after) the last element.
auto end() const -> const T*
auto cend() const -> const T*
auto front() -> T&
First element.
auto front() const -> const T&
auto back() -> T&
Last element.
auto back() const -> const T&
auto slice(T* begin, T* end) -> ArrayView<T>
View on a slice.
auto slice(const T* begin, const T* end) const -> ArrayView<const T>
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>
template<std::size_t count>
auto slice(T* begin) -> StaticArrayView<count, T>
Fixed-size view on a slice.
template<std::size_t count>
auto slice(const T* begin) const -> StaticArrayView<count, const T>
template<std::size_t count>
auto slice(std::size_t begin) -> StaticArrayView<count, T>
template<std::size_t count>
auto slice(std::size_t begin) const -> StaticArrayView<count, const T>
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> new in 2019.10
auto prefix(T* end) -> ArrayView<T>
View on a prefix until a pointer.
auto prefix(const T* end) const -> ArrayView<const T>
auto suffix(T* begin) -> ArrayView<T>
View on a suffix after a pointer.
auto suffix(const T* begin) const -> ArrayView<const T>
auto prefix(std::size_t count) -> ArrayView<T>
View on the first count items.
auto prefix(std::size_t count) const -> ArrayView<const T>
template<std::size_t count>
auto prefix() -> StaticArrayView<count, T>
Fixed-size view on the first count items.
template<std::size_t count>
auto prefix() const -> StaticArrayView<count, const T>
auto exceptPrefix(std::size_t count) -> ArrayView<T> new in Git master
View except the first count items.
auto exceptPrefix(std::size_t count) const -> ArrayView<const T> new in Git master
auto suffix(std::size_t begin) -> ArrayView<T> deprecated in Git master
Fixed-size view except the first count items.
auto suffix(std::size_t begin) const -> ArrayView<const T> deprecated in Git master
Fixed-size view except the first count items.
template<std::size_t count>
auto exceptPrefix() -> StaticArrayView<size_ - count, T> new in Git master
Fixed-size view except the first count items.
template<std::size_t count>
auto exceptPrefix() const -> StaticArrayView<size_ - count, const T> 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 count items.
template<std::size_t begin_>
auto suffix() const -> StaticArrayView<size_ - begin_, const T> deprecated in Git master
Fixed-size view except the first count items.
auto exceptSuffix(std::size_t count) -> ArrayView<T> new in Git master
View except the last count items.
auto exceptSuffix(std::size_t count) const -> ArrayView<const T> new in Git master
auto except(std::size_t count) -> ArrayView<T> deprecated in Git master
Fixed-size view except the last count items.
auto except(std::size_t count) const -> ArrayView<const T> deprecated in Git master
template<std::size_t count>
auto exceptSuffix() -> StaticArrayView<size_ - count, T> new in Git master
Fixed-size view except the last count items.
template<std::size_t count>
auto exceptSuffix() const -> StaticArrayView<size_ - count, const T> 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 count 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

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

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

Construct an in-place-initialized array.

The arguments are forwarded to the array constructor. Same as StaticArray(Args&&... args).

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

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)

Construct an in-place-initialized array.

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

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 &

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

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

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

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

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

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

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

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

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

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<count, 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 count>
StaticArrayView<count, const T> Corrade::Containers::StaticArray<size_, T>::slice(const T* begin) 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 count>
StaticArrayView<count, 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 count>
StaticArrayView<count, const T> Corrade::Containers::StaticArray<size_, T>::slice(std::size_t begin) 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 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 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>
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

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

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 count)

View on the first count 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 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 count>
StaticArrayView<count, T> Corrade::Containers::StaticArray<size_, T>::prefix()

Fixed-size view on the first count items.

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

template<std::size_t size_, class T> template<std::size_t count>
StaticArrayView<count, const T> Corrade::Containers::StaticArray<size_, T>::prefix() 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>
ArrayView<T> Corrade::Containers::StaticArray<size_, T>::exceptPrefix(std::size_t count) new in Git master

View except the first count 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 count) const 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 count 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 count items.

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

Fixed-size view except the first count items.

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

template<std::size_t size_, class T> template<std::size_t count>
StaticArrayView<size_ - count, const T> Corrade::Containers::StaticArray<size_, T>::exceptPrefix() const 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 count 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 count items.

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

View except the last count 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 count) const 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 count 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 count>
StaticArrayView<size_ - count, T> Corrade::Containers::StaticArray<size_, T>::exceptSuffix() new in Git master

Fixed-size view except the last count items.

Equivalent to StaticArrayView::exceptSuffix() const.

template<std::size_t size_, class T> template<std::size_t count>
StaticArrayView<size_ - count, const T> Corrade::Containers::StaticArray<size_, T>::exceptSuffix() const 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 count 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.