This commit is contained in:
Dynamitos
2023-11-27 22:50:37 +01:00
parent 54e66df4cd
commit d1475d506e
7 changed files with 15 additions and 29 deletions
+4 -4
View File
@@ -96,14 +96,14 @@ namespace Serialization
buffer.readBytes(type.data(), length * sizeof(char));
}
template<typename T>
static void save(ArchiveBuffer& buffer, const Array<T>& type) requires (std::is_integral_v<T> || std::is_floating_point_v<T>)
static void save(ArchiveBuffer& buffer, const Array<T>& type) requires (std::is_trivially_copyable_v<T>)
{
uint64 length = type.size();
buffer.writeBytes(&length, sizeof(uint64));
buffer.writeBytes(type.data(), sizeof(T) * type.size());
}
template<typename T>
static void load(ArchiveBuffer& buffer, Array<T>& type) requires (std::is_integral_v<T> || std::is_floating_point_v<T>)
static void load(ArchiveBuffer& buffer, Array<T>& type) requires (std::is_trivially_copyable_v<T>)
{
uint64 length = 0;
buffer.readBytes(&length, sizeof(uint64));
@@ -111,12 +111,12 @@ namespace Serialization
buffer.readBytes(type.data(), sizeof(T) * type.size());
}
template<typename T, size_t N>
static void save(ArchiveBuffer& buffer, const StaticArray<T, N>& type) requires (std::is_integral_v<T> || std::is_floating_point_v<T>)
static void save(ArchiveBuffer& buffer, const StaticArray<T, N>& type) requires (std::is_trivially_copyable_v<T>)
{
buffer.writeBytes(type.data(), sizeof(T) * N);
}
template<typename T, size_t N>
static void load(ArchiveBuffer& buffer, StaticArray<T, N>& type) requires (std::is_integral_v<T> || std::is_floating_point_v<T>)
static void load(ArchiveBuffer& buffer, StaticArray<T, N>& type) requires (std::is_trivially_copyable_v<T>)
{
buffer.readBytes(type.data(), sizeof(T) * N);
}