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 involve ranges or concepts are either not implemented or are implemented using C++14 paradigms.

This implementation of span is a guaranteed ABI- and interop-safe type.


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 a std::out_of_range exception as this is allowed for constexpr functions to cause a compiler error, however, if exceptions are disabled a CARB_CHECK will occur (this also disables constexpr as CARB_CHECK is not constexpr).

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