Skip to content

(De)serialize from C-style pointer without copy #35

Description

@Peter-McLean-Altera

It is not always possible to use std::vector, std::array, or c_array[] style types. Right now, deserialization from raw pointer (uint8_t*) requires a copy.

example:

MyStruct raw_pointer_deserialize(const uint8_t* ptr) {
  std::error_code ec;
  return deserialize<MyStruct>((const uint8_t*)ptr, sizeof(MyStruct), ec);
}

A version of from_bytes with std::is_pointer on the container and runtime size passed in may be all that is needed.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions