View over a contiguous sequence of items (pointer + size in elements).
More...
#include <Span.h>
|
template<size_t N, typename U = Type, EnableNotVoid< U > = true> |
constexpr | Span (U(&itemsArray)[N]) |
|
constexpr | Span () |
| Builds an empty Span.
|
|
constexpr | Span (Type *items, SizeType sizeInElements) |
| Builds a Span from an array.
|
|
template<typename U = Type> |
constexpr | Span (TypeIfNotVoid< U > &type) |
| Builds a Span from a single object.
|
|
template<typename U = Type> |
constexpr | Span (std::initializer_list< TypeIfNotVoid< U > > list) |
| Span specialized constructor (mainly used for converting const char* to StringView)
|
|
template<typename U = Type> |
| operator Span< const TypeIfNotVoid< U > > () const |
|
template<typename U = Type> |
| operator Span< TypeIfNotVoid< U > > () |
|
| operator Span< const void > () const |
|
| operator Span< void > () |
|
template<typename T > |
Span< const T > | reinterpret_as_span_of () const |
| Reinterprets the current span as an array of the specified type.
|
|
template<typename T > |
Span< T > | reinterpret_as_span_of () |
| Reinterprets the current span as an array of the specified type.
|
|
constexpr const Type * | begin () const |
|
constexpr const Type * | end () const |
|
constexpr const Type * | data () const |
|
constexpr Type * | begin () |
|
constexpr Type * | end () |
|
constexpr Type * | data () |
|
constexpr SizeType | sizeInElements () const |
|
constexpr SizeType | sizeInBytes () const |
|
constexpr bool | empty () const |
|
template<typename U = Type> |
TypeIfNotVoid< U > & | operator[] (SizeType idx) |
|
template<typename U = Type> |
const TypeIfNotVoid< U > & | operator[] (SizeType idx) const |
|
constexpr bool | sliceStart (SizeType offsetInElements, Span &destination) const |
| Creates another Span, starting at an offset in elements from current Span, until end.
|
|
constexpr bool | sliceStartLength (SizeType offsetInElements, SizeType lengthInElements, Span &destination) const |
| Creates another Span, starting at an offset in elements from current Span of specified length.
|
|
|
template<typename T > |
static Span< Type > | reinterpret_object (T &value) |
| Constructs a Span reinterpreting memory pointed by object of type T as a type Type
|
|
static Span< Type > | reinterpret_bytes (VoidType *rawMemory, SizeType sizeInBytes) |
| Construct a span reinterpreting raw memory (void* or const void* ) to Type or const Type
|
|
template<typename Type>
struct SC::Span< Type >
View over a contiguous sequence of items (pointer + size in elements).
- Template Parameters
-
◆ Span() [1/4]
◆ Span() [2/4]
template<typename Type >
SC::Span< Type >::Span |
( |
Type * | items, |
|
|
SizeType | sizeInElements ) |
|
inlineconstexpr |
Builds a Span from an array.
- Parameters
-
items | pointer to the first member of the array |
sizeInElements | number of elements in in the array |
◆ Span() [3/4]
template<typename Type >
template<typename U = Type>
SC::Span< Type >::Span |
( |
TypeIfNotVoid< U > & | type | ) |
|
|
inlineconstexpr |
Builds a Span from a single object.
- Parameters
-
type | A reference to a single object of type Type |
◆ Span() [4/4]
template<typename Type >
template<typename U = Type>
SC::Span< Type >::Span |
( |
std::initializer_list< TypeIfNotVoid< U > > | list | ) |
|
|
inlineconstexpr |
Span specialized constructor (mainly used for converting const char* to StringView)
- Parameters
-
list | an initializer list of elements |
◆ reinterpret_as_span_of() [1/2]
template<typename Type >
template<typename T >
Reinterprets the current span as an array of the specified type.
◆ reinterpret_as_span_of() [2/2]
template<typename Type >
template<typename T >
Span< const T > SC::Span< Type >::reinterpret_as_span_of |
( |
| ) |
const |
|
inlinenodiscard |
Reinterprets the current span as an array of the specified type.
◆ reinterpret_bytes()
template<typename Type >
static Span< Type > SC::Span< Type >::reinterpret_bytes |
( |
VoidType * | rawMemory, |
|
|
SizeType | sizeInBytes ) |
|
inlinestaticnodiscard |
Construct a span reinterpreting raw memory (void*
or const void*
) to Type
or const Type
◆ reinterpret_object()
template<typename Type >
template<typename T >
static Span< Type > SC::Span< Type >::reinterpret_object |
( |
T & | value | ) |
|
|
inlinestaticnodiscard |
Constructs a Span reinterpreting memory pointed by object of type T
as a type Type
◆ sliceStart()
template<typename Type >
bool SC::Span< Type >::sliceStart |
( |
SizeType | offsetInElements, |
|
|
Span< Type > & | destination ) const |
|
inlinenodiscardconstexpr |
Creates another Span, starting at an offset in elements from current Span, until end.
- Parameters
-
offsetInElements | Offset in current Span where destination Span will be starting |
destination | Reference to a Span that will hold the resulting sliced span |
- Returns
false
if offsetInElements is bigger to than Span::sizeInElements().
◆ sliceStartLength()
template<typename Type >
bool SC::Span< Type >::sliceStartLength |
( |
SizeType | offsetInElements, |
|
|
SizeType | lengthInElements, |
|
|
Span< Type > & | destination ) const |
|
inlinenodiscardconstexpr |
Creates another Span, starting at an offset in elements from current Span of specified length.
- Parameters
-
offsetInElements | Offset in current Span where destination Span will be starting |
lengthInElements | Number of elements to include in destination Span |
destination | Reference to a Span that will hold the resulting sliced span |
- Returns
- false` if (offsetInElements + lengthInElements) is bigger to than Span::sizeInElements().
The documentation for this struct was generated from the following file: