1#ifndef SDL3PP_SPAN_REF_H_
2#define SDL3PP_SPAN_REF_H_
10template<
class T,
class BASE>
12 std::derived_from<T, BASE> &&
sizeof(T) ==
sizeof(BASE);
28 constexpr SpanRef() =
default;
31 template<DerivedWrapper<T> U,
size_t N>
33 : value(static_cast<T*>(other), N)
38 template<DerivedWrapper<T> U>
39 constexpr SpanRef(
const std::span<U>& other)
45 template<std::contiguous_iterator It>
48 : value((T*)(&*first), count)
53 template<std::contiguous_iterator It, std::sized_sentinel_for<It> End>
56 : value((T*)(&*first), size_t(last - first))
61 template<std::ranges::contiguous_range R>
64 : SpanRef(std::begin(range), std::end(range))
69 constexpr size_t size()
const {
return value.size(); }
72 constexpr size_t size_bytes()
const {
return value.size_bytes(); }
75 constexpr T*
data()
const {
return value.data(); }
constexpr SpanRef(U(&other)[N])
Constructor.
Definition SDL3pp_spanRef.h:32
constexpr T * data() const
Retrieves contained data.
Definition SDL3pp_spanRef.h:75
constexpr SpanRef(const std::span< U > &other)
Constructor.
Definition SDL3pp_spanRef.h:39
constexpr SpanRef(It first, size_t count)
Constructor.
Definition SDL3pp_spanRef.h:47
constexpr SpanRef(It first, End last)
Constructor.
Definition SDL3pp_spanRef.h:55
constexpr size_t size() const
Retrieves contained size.
Definition SDL3pp_spanRef.h:69
constexpr size_t size_bytes() const
Retrieves contained size in bytes.
Definition SDL3pp_spanRef.h:72
constexpr SpanRef(R &&range)
Constructor.
Definition SDL3pp_spanRef.h:63
Definition SDL3pp_spanRef.h:11
Main include header for the SDL3pp library.