diff --git a/Include/Aurora/Memory/ByteBuffer_TypedReadWrite.inl b/Include/Aurora/Memory/ByteBuffer_TypedReadWrite.inl index fdcc4186..affc9779 100644 --- a/Include/Aurora/Memory/ByteBuffer_TypedReadWrite.inl +++ b/Include/Aurora/Memory/ByteBuffer_TypedReadWrite.inl @@ -90,10 +90,18 @@ namespace Aurora::Memory { if constexpr (AuIsTuple_v>) { + if (this->ReadTagged != + AuTupleCountOf_v>) + { + this->flagReadError = true; + return false; + } + AuTupleForEach(out, [=](auto &tupleElement) { - Read(tupleElement); + ReadTagged(tupleElement); }); + return !this->flagReadError; } else if constexpr (AuIsOptional_v>) @@ -102,7 +110,7 @@ namespace Aurora::Memory { AuRemoveReference_t value; - Read(value); + ReadTagged(value); if (this->flagReadError) { @@ -246,16 +254,19 @@ namespace Aurora::Memory { if constexpr (AuIsTuple_v>) { + this->WriteTagged(AuTupleCountOf_v>); + AuTupleForEach(in, [=](auto &tupleElement) { - Write(tupleElement); + WriteTagged(tupleElement); }); + return !this->flagWriteError; } else if constexpr (AuIsOptional_v>) { Write(AuStaticCast(in)); - Write(in.value()); + WriteTagged(in.value()); return !this->flagWriteError; } else if constexpr (AuIsBaseOfTemplate>::value)