Skip to content

std::move data out of DynamicMemoryWriter when GetReader called #376

Description

@Brett208

Likely blocked until issue #375 is implemented. See PR #373 for additional discussion.

Currently calling 'DynamicMemoryWriter::GetReader' provides access to data within DynamicMemoryWriter without transferring ownership.

Currently you should never attempt to clear DynamicMemoryWriter's internal stored data for future writes in case a Reader is still referencing the content. This can be avoided procedurally by always creating a new instance of DynamicMemoryWriter after GetReader is called for future dynamic memory reads. Some discussion if the procedural approach is actually more appropriate than adding a clear type concept to DynamicMemoryWriter.

I did try to add a Clear function to DynamicMemoryWriter before understanding the relationship of shared data between the Reader and Writer although that may not be in line with how others would intuitively try to use DynamicMemoryWriter.

Example Clear command for future consideration:

// Clear all currently set memory
void DynamicMemoryWriter::Clear() {
	SeekBeginning();
	streamBuffer.clear();
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions