#include <Corrade/Containers/StaticArray.h>
template<std:: size_t size_, class T>
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::
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) shown in the example snippet above. Again useful when you want to make the choice appear explicit). In other words,
T array[size]{args...}
. Note that the variadic template means you can't use{}
for nested type initializers but have to specify the types explicitly. An alternative is directly passing an array, i.e. with the items wrapped in an additional{}
, with StaticArray(InPlaceInitT, const T(&)[size]) or StaticArray(InPlaceInitT, T(&&)[size]), or using the implicit StaticArray(const T(&)[size]) and StaticArray(T(&&)[size]) variants. - 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};
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::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.
C++17 structured bindings
If Corrade/get<i>()
overloads are defined inside StaticArray itself, a separate header is used for the std::#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::#include <span>
, which significantly affects compile times. The following table lists allowed conversions:
Corrade type | ↭ | STL type |
---|---|---|
StaticArray<size, T> | → | std:: |
StaticArray<size, T> | → | std:: |
const StaticArray<size, T> | → | std:: |
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.
-
template<std::StaticArray(Corrade::
size_t size> 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.
-
template<std::StaticArray(Corrade::
size_t size> 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.
-
template<std::StaticArray(const T(&data)[size]) explicit constexpr new in Git master
size_t size> - In-place construct an array by copying the elements from a fixed-size array.
-
template<std::StaticArray(T( && data)[size]) explicit constexpr new in Git master
size_t size> - 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::operator U()
declval<StaticArrayView<size_, T>>()))> - Convert to external view representation.
-
template<class U, class = decltype(Implementation::StaticArrayViewConverter<size_, const T, U>::to(std::operator U() const constexpr
declval<StaticArrayView<size_, const T>>()))> - 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::auto slice(T* begin) -> StaticArrayView<size__, T>
size_t size__> - Fixed-size view on a slice.
-
template<std::auto slice(const T* begin) const -> StaticArrayView<size__, const T> constexpr
size_t size__> -
template<std::auto slice(std::
size_t size__> size_t begin) -> StaticArrayView<size__, T> -
template<std::auto slice(std::
size_t size__> size_t begin) const -> StaticArrayView<size__, const T> constexpr -
template<std::auto slice() -> StaticArrayView<end_ - begin_, T> new in 2019.10
size_t begin_, std:: size_t end_> - Fixed-size view on a slice.
-
template<std::auto slice() const -> StaticArrayView<end_ - begin_, const T> constexpr new in 2019.10
size_t begin_, std:: size_t end_> -
template<std::auto sliceSize() -> StaticArrayView<size__, T> new in Git master
size_t begin_, std:: size_t size__> - Fixed-size view on a slice of given size.
-
template<std::auto sliceSize() const -> StaticArrayView<size__, const T> constexpr new in Git master
size_t begin_, std:: size_t size__> - 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::auto prefix() -> StaticArrayView<size__, T>
size_t size__> - Fixed-size view on the first
size__
items. -
template<std::auto prefix() const -> StaticArrayView<size__, const T> constexpr
size_t size__> -
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::auto exceptPrefix() -> StaticArrayView<size_ - size__, T> new in Git master
size_t size__> - Fixed-size view except the first
size__
items. -
template<std::auto exceptPrefix() const -> StaticArrayView<size_ - size__, const T> constexpr new in Git master
size_t size__> -
template<std::auto suffix() -> StaticArrayView<size_ - begin_, T> deprecated in Git master
size_t begin_> - Fixed-size view except the first
size__
items. -
template<std::auto suffix() const -> StaticArrayView<size_ - begin_, const T> deprecated in Git master
size_t begin_> - 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::auto exceptSuffix() -> StaticArrayView<size_ - size__, T> new in Git master
size_t size__> - Fixed-size view except the last
size__
items. -
template<std::auto exceptSuffix() const -> StaticArrayView<size_ - size__, const T> constexpr new in Git master
size_t size__> -
template<std::auto except() -> StaticArrayView<size_ - count, T> deprecated in Git master
size_t count> - Fixed-size view except the last
size__
items. -
template<std::auto except() const -> StaticArrayView<size_ - count, const T> deprecated in Git master
size_t count>
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::
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).
To prevent accidents, compared to regular C array initialization the constructor expects the number of arguments to match the size exactly. I.e., it's not possible to omit a suffix of the array to implicitly value-initialize it.
template<std:: size_t size_, class T>
template<std:: size_t size>
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]).
To prevent accidents, compared to regular C array initialization the constructor expects the number of arguments to match the size exactly. I.e., it's not possible to omit a suffix of the array to implicitly value-initialize it.
template<std:: size_t size_, class T>
template<std:: size_t size>
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 an 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.
template<std:: size_t size_, class T>
template<std:: size_t size>
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.
template<std:: size_t size_, class T>
template<std:: size_t size>
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::
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::
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::
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.
StaticArrayView<end_ - begin_, T> Corrade:: Containers:: StaticArray<size_, T>:: slice() new in 2019.10
Fixed-size view on a slice.
Equivalent to StaticArrayView::
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.
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::
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::
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::
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::
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::
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::
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::
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::
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::
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.