Skip to content

Commit

Permalink
add example for binary_stream instantiation with external resoruce
Browse files Browse the repository at this point in the history
  • Loading branch information
farukeryilmaz committed Jan 9, 2024
1 parent f8e3dff commit 6550604
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions doc/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,15 @@ std::size_t dataSize = buffer.size(); // total serialized data size (44 byte).
```
### Simple Deserialization - 1 (_buffer instantiated with external resource_)
```cpp
```cpp
std::array<char, 1024 * 10> externalBuffer;
// ... other code to fill the buffer with data
// Data to deserialize into
int intArr_[10]{};
float num_{};
// create `bytepack::buffer_view buffer(..` with a resource to deserialize from.
bytepack::binary_stream stream(buffer);
bytepack::binary_stream stream(bytepack::buffer_view(externalBuffer));
stream.read(intArr_);
stream.read(num_);
Expand Down

0 comments on commit 6550604

Please sign in to comment.