summaryrefslogtreecommitdiff
path: root/include/fud_span.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/fud_span.hpp')
-rw-r--r--include/fud_span.hpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/fud_span.hpp b/include/fud_span.hpp
index e8c5704..cc693f8 100644
--- a/include/fud_span.hpp
+++ b/include/fud_span.hpp
@@ -43,6 +43,22 @@ struct Span {
return output;
}
+ template <typename U>
+ static Span make(Array<U, Size>& array) {
+ static_assert(std::convertible_to<U, T>);
+ Span<T, Size> output{};
+ output.m_data = array.data();
+ return output;
+ }
+
+ template <size_t ArraySize>
+ static Span makeCStringBuffer(Array<T, ArraySize>& array) {
+ static_assert(ArraySize > Size);
+ Span<T, Size> output{};
+ output.m_data = array.data();
+ return output;
+ }
+
T* m_data;
[[nodiscard]] constexpr size_t size() const