summaryrefslogtreecommitdiff
path: root/include/fud_span.hpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2024-10-21 12:49:43 -0500
committerDominick Allen <djallen@librehumanitas.org>2024-10-21 12:49:43 -0500
commitb2dbcb55e2832c373fecb4033a3ed77e5dbc77aa (patch)
tree1f294fcf1d85a02db86de3eea2b03393fd89ca5a /include/fud_span.hpp
parent6a27a2a4032e88fa9154ef0f0741edc584f7a701 (diff)
Add vector and option.
Diffstat (limited to 'include/fud_span.hpp')
-rw-r--r--include/fud_span.hpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/fud_span.hpp b/include/fud_span.hpp
index 5b8497e..ed4bcc7 100644
--- a/include/fud_span.hpp
+++ b/include/fud_span.hpp
@@ -18,7 +18,6 @@
#ifndef FUD_SPAN_HPP
#define FUD_SPAN_HPP
-#include "fud_array.hpp"
#include "fud_result.hpp"
#include "fud_status.hpp"
@@ -27,11 +26,17 @@
namespace fud {
+template <typename T, size_t Size>
+struct Array;
+
template <typename T, size_t Size = SIZE_MAX>
struct Span {
static_assert(Size > 0);
using ValueType = T;
+ T* m_data;
+ const size_t m_size;
+
static Span make(Array<T, Size>& array)
{
Span<T, Size> output{array.data(), Size};
@@ -89,9 +94,6 @@ struct Span {
return output;
}
- T* m_data;
- const size_t m_size;
-
[[nodiscard]] constexpr size_t size() const
{
if constexpr (Size < SIZE_MAX) {