use cpp23 and 'modernize'

This commit is contained in:
REL
2025-01-07 20:16:14 -05:00
parent 66b29b1374
commit e56a6228aa
6 changed files with 144 additions and 109 deletions

View File

@@ -1,5 +1,6 @@
#pragma once
#include <cstdint>
#include <span>
template <typename T>
class Array
@@ -16,6 +17,10 @@ public:
T* data() {
return vector;
}
std::span<T> AsSpan() {
return { vector, max_length };
}
};
static_assert(alignof(Array<uint8_t>) == 8, "Array alignment is incorrect");
@@ -29,6 +34,10 @@ struct PacketMeta
uint16_t HeaderLength;
uint32_t DataLength;
uint8_t Data[1];
std::span<uint8_t> AsSpan() {
return {Data, DataLength};
}
};
#pragma pack(pop)