simple_span#
-
namespace std_#
Namespace that provides lightweight standard-library-like utilities.
-
template<typename T>
class span# - #include <simple_span.h>
Lightweight non-owning view over a contiguous sequence of elements.
Provides a subset of the C++20
std::spaninterface without depending on C++20. The span does not own the underlying storage; the caller is responsible for ensuring the pointed-to data remains valid for the lifetime of the span.- Template Parameters:
T – Element type of the sequence.
Public Functions
-
inline span(T *data, std::size_t size)#
Constructs a span from a pointer and an element count.
- Parameters:
data – Pointer to the first element of the sequence.
size – Number of elements in the sequence.
-
inline T &operator[](std::size_t index) const#
Returns a reference to the element at the given index.
- Parameters:
index – Zero-based position of the element to access.
- Returns:
Reference to the element at index.
-
template<typename T>