template<typename T, size_t Extent = -1>
span class
A non-owning view of contiguous elements.
Template parameters | |
---|---|
T | The span's element type. |
Extent | The number of elements in the span (-1 == dynamic). |
Public types
- using const_pointer = const T*
- Const-qualified pointer to a single element in the span.
- using const_reference = const T&
- Const-qualified reference to a single element in the span.
- using difference_type = ptrdiff_t
- The difference between two pointers.
- using element_type = T
- The span's element type.
- using iterator = pointer
- The iterator type returned by begin() and end().
- using pointer = T*
- Pointer to a single element in the span.
- using reference = T&
- Reference to a single element in the span.
- using size_type = size_t
- The unsigned integer type used for sizes, indices, et cetera.
- using value_type = api_detail::remove_cv<T>
- The span's element type without any cv-qualifiers.
Public static variables
Constructors, destructors, conversion operators
- operator bool() const explicit constexpr noexcept
- Returns true if the span's extent is greater than zero and the data pointer is not null.
- operator span<const T, Extent>() const constexpr noexcept
- Casts the span to the const equivalent.
- span() defaulted constexpr noexcept
- Default constructor.
- span(const span&) defaulted constexpr noexcept
- Copy constructor.
-
span(T* ptr,
size_
type count) constexpr noexcept - Pointer + count constructor.
-
template<size_span(T(&arr)[N]) constexpr noexcept
type N> - Array constructor.
Public functions
- auto back() const -> reference constexpr noexcept
- Returns a reference to the last element in the span.
- auto begin() const -> iterator constexpr noexcept
- Returns an iterator to the first element represented by the span.
- auto data() const -> pointer constexpr noexcept
- Returns a pointer to the first element represented by the span.
- auto empty() const -> bool constexpr noexcept
- Returns true if the span's extent is greater than zero.
- auto end() const -> iterator constexpr noexcept
- Returns an iterator to one-past-the-last element represented by the span.
- auto front() const -> reference constexpr noexcept
- Returns a reference to the first element in the span.
-
auto length() const -> size_
type constexpr noexcept - Returns the number of elements represented by the span.
- auto operator=(const span&) -> span& defaulted noexcept
- Copy-assignment operator.
-
auto operator[](size_
type idx) const -> reference constexpr noexcept - Returns a reference to an element in the span.
-
auto size() const -> size_
type constexpr noexcept - Returns the number of elements represented by the span.
-
auto size_bytes() const -> size_
type constexpr noexcept - Returns the size of the memory region represented by the span, in bytes.
Compatibility with UE4
-
template<typename Alloc>span(::TArray<T, Alloc>& arr) noexcept
- Constructs a span from a UE4 TArray.
-
template<typename SizeType>span(const ::TArrayView<T, SizeType>& view) noexcept
- Constructs a span from a UE4 TArrayView.
Typedef documentation
template<typename T, size_t Extent>
using stim:: span<T, Extent>:: const_reference = const T&
Const-qualified reference to a single element in the span.
Function documentation
template<typename T, size_t Extent>
reference stim:: span<T, Extent>:: operator[](size_ type idx) const constexpr noexcept
Returns a reference to an element in the span.
stim:: span<T, Extent>:: span(const ::TArrayView<T, SizeType>& view) noexcept
Constructs a span from a UE4 TArrayView.