Skip to content

Conversation

@igromanru
Copy link
Contributor

Here is a possible implementation of what I was talking about in #3.
To allow Packer and Unpacker to use concept ByteType without explicitly specify the type, you have to add a "deduction guide" or multiple, if needed.

@rwindegger rwindegger linked an issue Oct 31, 2025 that may be closed by this pull request
@rwindegger
Copy link
Owner

I've put some work into the branch to make it buildable again.

It would be nice if we find a way to make:

auto [int8] = msgpack23::unpack<std::byte, UInt8Struct>(data);

look like:

auto [int8] = msgpack23::unpack<UInt8Struct>(data);

@rwindegger
Copy link
Owner

@igromanru do you have an idea about my last comment?

If not you can set the branch to Ready for review then I can merge it.

@igromanru
Copy link
Contributor Author

I'll look at it later.

@igromanru
Copy link
Contributor Author

No idea. I'm not a C++ templating Wizard.
Implementing ByteType was simple enough.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR extends the Packer and Unpacker classes to support any byte type (not just std::byte) through C++20 concepts and deduction guides, enabling more flexible usage with containers of char, unsigned char, std::uint8_t, std::int8_t, and std::byte.

  • Introduced a byte_type concept to constrain supported byte types
  • Added deduction guides for Packer and Unpacker to automatically infer the byte type from constructor arguments
  • Refactored pack/unpack functions to support generic byte type containers

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
include/msgpack23/msgpack23.h Core implementation: added byte_type concept, templatized Packer and Unpacker on byte type, added deduction guides, and updated all byte operations to use generic type parameter
tests/byte_type_tests.cpp New comprehensive test file covering packing/unpacking with unsigned char, std::uint8_t, char, and std::int8_t
tests/CMakeLists.txt Added new byte_type_tests.cpp to the test build
tests/object_packing_tests.cpp Minor const correctness improvement for unpacked object
tests/exception_tests.cpp Updated to explicitly specify template parameter for default-constructed Unpacker instances
examples/first_example.cpp Simplified by removing custom converting_insert_iterator, now using deduction guides directly
examples/second_example.cpp Simplified by removing custom converting_insert_iterator, now using deduction guides directly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rwindegger rwindegger merged commit 2c741b4 into rwindegger:main Nov 28, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Please use unsigned char instead of std::byte or add support for it.

2 participants