class Array
Declaration
template <class T, size_t N>
class Array { /* full declaration omitted */ };
Description
A collection of objects of type `T`, with a fixed size `N`. An Array can not be larger than [`isize::MAX`]($sus::num::isize::MAX), as subtracting a pointer at a greater distance results in Undefined Behaviour.
Declared at: sus/collections/array.h:71
Templates
- T
- size_t N
Method Overview
- public Array<T, N>(Array<T, N> &&)
- public Array<T, N>(Array<T, N> &&)
- public Array<T, N>(Array<T, N> &&)
- public template <class... Ts>constexpr Array<T, N>(Ts &&... ts) noexcept
- public constexpr Array<T, N>() noexcept
- public inline constexpr T * as_mut_ptr() & noexcept
- public constexpr SliceMut<T> as_mut_slice() & noexcept
- public const T * as_ptr() &&
- public inline constexpr const T * as_ptr() const & noexcept
- public constexpr Slice<T> as_slice() const & noexcept
- public constexpr Slice<T> as_slice() &&
- public constexpr Array<T, N> clone() const & noexcept
- public constexpr void clone_from(const Array<T, N> & source) & noexcept
- public constexpr Option<const T &> get(sus::num::usize i) &&
- public constexpr Option<const T &> get(sus::num::usize i) const & noexcept
- public constexpr Option<T &> get_mut(sus::num::usize i) & noexcept
- public inline constexpr const T & get_unchecked(::sus::marker::UnsafeFnMarker, sus::num::usize i) const & noexcept
- public inline constexpr const T & get_unchecked(::sus::marker::UnsafeFnMarker, sus::num::usize i) &&
- public inline constexpr T & get_unchecked_mut(::sus::marker::UnsafeFnMarker, sus::num::usize i) & noexcept
- public template <int &... , class U = T>constexpr ArrayIntoIter<U, N> into_iter() && noexcept
- public constexpr SliceIter<const T &> iter() const & noexcept
- public constexpr SliceIter<const T &> iter() &&
- public constexpr SliceIterMut<T &> iter_mut() & noexcept
- public constexpr sus::num::usize len() const & noexcept
- public template <class MapFn>int map(MapFn f) && noexcept
- public constexpr Slice<T> operator Slice<type-parameter-0-0>() const & noexcept
- public constexpr Slice<T> operator Slice<type-parameter-0-0>() const & noexcept
- public constexpr Slice<T> operator Slice<type-parameter-0-0>() &&
- public constexpr Slice<T> operator Slice<type-parameter-0-0>() & noexcept
- public constexpr Slice<T> operator Slice<type-parameter-0-0>() & noexcept
- public constexpr SliceMut<T> operator SliceMut<type-parameter-0-0>() & noexcept
- public constexpr SliceMut<T> operator SliceMut<type-parameter-0-0>() & noexcept
- public template <class f:auto>static constexpr Array<T, N> with_initializer(::sus::fn::FnMut<T ()> auto f) noexcept
- public template <class U>static constexpr Array<T, N> with_value(const U & t) noexcept
- public ~Array<T, N>()
- public ~Array<T, N>()
Methods
¶Array<T, N>(Array<T, N>&&)
Array<T, N>(Array<T, N>&&)
Declared at: sus/collections/array.h:126
Parameters
- Array<T, N>&&
¶Array<T, N>(Array<T, N>&&)
Array<T, N>(Array<T, N>&&)
Declared at: sus/collections/array.h:126
Parameters
- Array<T, N>&&
¶Array<T, N>(Array<T, N>&&)
Array<T, N>(Array<T, N>&&)
Declared at: sus/collections/array.h:126
Parameters
- Array<T, N>&&
¶template <class... Ts>
constexpr Array<T, N>(Ts&&... ts) noexcept
template <class... Ts>
constexpr Array<T, N>(Ts&&... ts) noexcept
Description
Constructs an `Array` with `N` elements from the `N` arguments given to the constructor. #[doc.overloads=ctor.values]
Declared at: sus/collections/array.h:98
Templates
- Ts
Parameters
- Ts&&... ts
¶constexpr Array<T, N>() noexcept
constexpr Array<T, N>() noexcept
Declared at: sus/collections/array.h:88
¶inline constexpr T* as_mut_ptr() & noexcept
inline constexpr T* as_mut_ptr() & noexcept
Description
Returns a mutable pointer to the first element in the array.
Declared at: sus/collections/array.h:261
¶constexpr SliceMut<T> as_mut_slice() & noexcept
constexpr SliceMut<T> as_mut_slice() & noexcept
Declared at: sus/collections/array.h:276
¶const T* as_ptr() &&
const T* as_ptr() &&
Declared at: sus/collections/array.h:258
¶inline constexpr const T* as_ptr() const& noexcept
inline constexpr const T* as_ptr() const& noexcept
Description
Returns a const pointer to the first element in the array.
Declared at: sus/collections/array.h:253
¶constexpr Slice<T> as_slice() const& noexcept
constexpr Slice<T> as_slice() const& noexcept
Declared at: sus/collections/array.h:269
¶constexpr Slice<T> as_slice() &&
constexpr Slice<T> as_slice() &&
Declared at: sus/collections/array.h:272
¶constexpr Array<T, N> clone() const& noexcept
constexpr Array<T, N> clone() const& noexcept
Declared at: sus/collections/array.h:159
¶constexpr void clone_from(
const Array<T, N>& source) & noexcept
constexpr void clone_from(
const Array<T, N>& source) & noexcept
Declared at: sus/collections/array.h:170
Parameters
- const Array<T, N>& source
¶constexpr Option<const T&> get(
sus::num::usize i) &&
constexpr Option<const T&> get(
sus::num::usize i) &&
Declared at: sus/collections/array.h:203
Parameters
¶constexpr Option<const T&> get(
sus::num::usize i) const& noexcept
constexpr Option<const T&> get(
sus::num::usize i) const& noexcept
Description
Returns a const reference to the element at index `i`.
Declared at: sus/collections/array.h:196
Parameters
¶constexpr Option<T&> get_mut(
sus::num::usize i) & noexcept
constexpr Option<T&> get_mut(
sus::num::usize i) & noexcept
Description
Returns a mutable reference to the element at index `i`.
Declared at: sus/collections/array.h:206
Parameters
¶inline constexpr const T& get_unchecked(
::sus::marker::UnsafeFnMarker,
sus::num::usize i) const& noexcept
inline constexpr const T& get_unchecked(
::sus::marker::UnsafeFnMarker,
sus::num::usize i) const& noexcept
Description
Returns a const reference to the element at index `i`. # Safety The index `i` must be inside the bounds of the array or Undefined Behaviour results.
Declared at: sus/collections/array.h:219
Parameters
¶inline constexpr const T& get_unchecked(
::sus::marker::UnsafeFnMarker,
sus::num::usize i) &&
inline constexpr const T& get_unchecked(
::sus::marker::UnsafeFnMarker,
sus::num::usize i) &&
Declared at: sus/collections/array.h:225
Parameters
¶inline constexpr T& get_unchecked_mut(
::sus::marker::UnsafeFnMarker,
sus::num::usize i) & noexcept
inline constexpr T& get_unchecked_mut(
::sus::marker::UnsafeFnMarker,
sus::num::usize i) & noexcept
Description
Returns a mutable reference to the element at index `i`. # Safety The index `i` must be inside the bounds of the array or Undefined Behaviour results.
Declared at: sus/collections/array.h:233
Parameters
¶template <int&..., class U = T>
constexpr ArrayIntoIter<U, N>
into_iter() && noexcept
template <int&..., class U = T>
constexpr ArrayIntoIter<U, N>
into_iter() && noexcept
Description
Converts the array into an iterator that consumes the array and returns each element in the same order they appear in the array.
Declared at: sus/collections/array.h:314
Templates
- int &
- U
¶constexpr SliceIter<const T&> iter()
const& noexcept
constexpr SliceIter<const T&> iter()
const& noexcept
Description
Returns an iterator over all the elements in the array, visited in the same order they appear in the array. The iterator gives const access to each element.
Declared at: sus/collections/array.h:283
¶constexpr SliceIter<const T&> iter() &&
constexpr SliceIter<const T&> iter() &&
Declared at: sus/collections/array.h:295
¶constexpr SliceIterMut<T&> iter_mut() & noexcept
constexpr SliceIterMut<T&> iter_mut() & noexcept
Description
Returns an iterator over all the elements in the array, visited in the same order they appear in the array. The iterator gives mutable access to each element.
Declared at: sus/collections/array.h:300
¶constexpr sus::num::usize len() const& noexcept
constexpr sus::num::usize len() const& noexcept
Description
Returns the number of elements in the array.
Declared at: sus/collections/array.h:193
¶template <class MapFn>
int map(MapFn f) && noexcept
template <class MapFn>
int map(MapFn f) && noexcept
Declared at: sus/collections/array.h:327
Templates
- MapFn
Parameters
- MapFn f
¶constexpr Slice<T> operator Slice<
type - parameter - 0 - 0>() const& noexcept
constexpr Slice<T> operator Slice<
type - parameter - 0 - 0>() const& noexcept
Declared at: sus/collections/array.h:365
¶constexpr Slice<T> operator Slice<
type - parameter - 0 - 0>() const& noexcept
constexpr Slice<T> operator Slice<
type - parameter - 0 - 0>() const& noexcept
Declared at: sus/collections/array.h:365
¶constexpr Slice<T>
operator Slice<type - parameter - 0 - 0>() &&
constexpr Slice<T>
operator Slice<type - parameter - 0 - 0>() &&
Declared at: sus/collections/array.h:378
¶constexpr Slice<T> operator Slice<
type - parameter - 0 - 0>() & noexcept
constexpr Slice<T> operator Slice<
type - parameter - 0 - 0>() & noexcept
Declared at: sus/collections/array.h:379
¶constexpr Slice<T> operator Slice<
type - parameter - 0 - 0>() & noexcept
constexpr Slice<T> operator Slice<
type - parameter - 0 - 0>() & noexcept
Declared at: sus/collections/array.h:379
¶constexpr SliceMut<T> operator SliceMut<
type - parameter - 0 - 0>() & noexcept
constexpr SliceMut<T> operator SliceMut<
type - parameter - 0 - 0>() & noexcept
Declared at: sus/collections/array.h:394
¶constexpr SliceMut<T> operator SliceMut<
type - parameter - 0 - 0>() & noexcept
constexpr SliceMut<T> operator SliceMut<
type - parameter - 0 - 0>() & noexcept
Declared at: sus/collections/array.h:394
¶template <class f : auto>
static constexpr Array<T, N> with_initializer(
::sus::fn::FnMut<T()> auto f) noexcept
template <class f : auto>
static constexpr Array<T, N> with_initializer(
::sus::fn::FnMut<T()> auto f) noexcept
Declared at: sus/collections/array.h:118
Templates
- f:auto
Parameters
- ::sus::fn::FnMut<T()> auto f
¶template <class U>
static constexpr Array<T, N> with_value(
const U& t) noexcept
template <class U>
static constexpr Array<T, N> with_value(
const U& t) noexcept
Description
Constructs an `Array` with `N` elements from a single argument, repeatedly using it to construct each element. The given argument must be `Copy` in order to do this. To construct an Array from a single value that is `Clone` but not `Copy`, use `with_initializer([ &x ]() -> T { return sus::clone(x); })`;
Declared at: sus/collections/array.h:110
Templates
- U
Parameters
- const U& t
¶~Array<T, N>()
~Array<T, N>()
Declared at: sus/collections/array.h:183
¶~Array<T, N>()
~Array<T, N>()
Declared at: sus/collections/array.h:183