Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation error when std::variant has the same types #1112

Merged
merged 1 commit into from Apr 2, 2024

Conversation

uyha
Copy link

@uyha uyha commented Apr 2, 2024

No description provided.

@uyha
Copy link
Author

uyha commented Apr 2, 2024

@redboltz could you have a look and create a minor release if everything is good? I need this for my project.

@codecov-commenter
Copy link

Codecov Report

Merging #1112 (d812fa5) into cpp_master (e9e06a5) will not change coverage.
The diff coverage is 50.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           cpp_master    #1112   +/-   ##
===========================================
  Coverage       85.75%   85.75%           
===========================================
  Files              80       80           
  Lines            5091     5091           
===========================================
  Hits             4366     4366           
  Misses            725      725           

@redboltz
Copy link
Contributor

redboltz commented Apr 2, 2024

Thank you for sending the PR.
I didn't know about in_place_index_t. It can clarify the index!
I will merge it and will release the updated version ASAP.

Just my curious, when do you use std::variant that contains the same types?

@redboltz redboltz merged commit c593c32 into msgpack:cpp_master Apr 2, 2024
25 checks passed
@uyha uyha deleted the same-type-variant branch April 2, 2024 07:28
@uyha
Copy link
Author

uyha commented Apr 2, 2024

I have a very heavy template code base and there's basically a type list that is a list of events. For example,

using Events = TypeList<Event1, Event2, Event3>;

This list will be used as common source for events coming in and out. Sometimes, the event list isn't used as is because the receiving end doesn't accept an "event", but some modified version of those "event"s and a modified version can be

template<typename>
using TimePoint = std::chrono::system_clock::time_point_t;

So a receiving end can sometimes accept a std::variant<Event1, Event2, Event3> and sometimes it can accept a std::variant<TimePoint<Event1>, TimePoint<Event2>, TimePoint<Event3>> (which is a variant having same types).

(I'm not sure if I make it clearer or not, if you want to know more, please let me know)

@redboltz
Copy link
Contributor

redboltz commented Apr 3, 2024

Thank you for the comment. I understand your situation. Good to know :)

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.

None yet

3 participants