omni::span
Defined in omni/Span.h
-
template<class T, size_t Extent = dynamic_extent>
using omni::span = carb::cpp::span<T, Extent> An object that refers to a contiguous sequence of objects.
The class template span describes an object that can refer to a contiguous sequence of objects with the first element of the sequence at position zero. A span can either have a static extent, in which case the number of elements in the sequence is known at compile-time and encoded in the type, or a dynamic extent.
If a span has dynamic extent, this implementation holds two members: a pointer to T and a size. A span with static extent has only one member: a pointer to T.
Every specialization of
span
is a TriviallyCopyable type.This implementation of
span
is a C++14-compatible implementation of the C++20 std::span, as such certain constructors that involveranges
orconcepts
are either not implemented or are implemented using C++14 paradigms.This implementation of
span
is a guaranteed ABI- and interop-safe type.Note
For function definitions below the following definitions are used: An ill-formed program will generate a compiler error via
static_assert
. Undefined behavior is typically signaled by throwing astd::out_of_range
exception as this is allowed forconstexpr
functions to cause a compiler error, however, if exceptions are disabled a CARB_CHECK will occur (this also disablesconstexpr
as CARB_CHECK is notconstexpr
).- Template Parameters
T – Element type; must be a complete object type that is not an abstract class type
Extent – The number of elements in the sequence, or dynamic_extent if dynamic