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

Support for multiple identical types? #40

Closed
AnthonyVH opened this issue Oct 29, 2020 · 5 comments
Closed

Support for multiple identical types? #40

AnthonyVH opened this issue Oct 29, 2020 · 5 comments

Comments

@AnthonyVH
Copy link
Contributor

The current implementation of variant-lite does not support multiple identical types (i.e. nonstd::variant<int, int>). On the other hand, this works perfectly fine in C++17's std::variant.

Are there any plans to support this as well in variant-lite? If so, what exactly prevents it from working right now? I can't think of a technical issue implementing this in C++11, but I have no clue about C++98.

@martinmoene
Copy link
Owner

@AnthonyVH Thanks for your interest in variant-lite.

I didn't have plans to support multiple identical types. I cannot answer the question what is preventing it now, although it may well have to do with what C++98 is capable of or not.

It isn't likely I can, or choose to spend time on this any time soon I'm afraid.

@AnthonyVH
Copy link
Contributor Author

No worries. I messed around with the code a bit tonight and I think I it working like exactly like std::variant.

I'll try to get the required macro and template mess cleaned up and create a pull request.

@martinmoene
Copy link
Owner

Just to be sure: include/variant.hpp is generated from template/variant.hpp using script/generate_header.py.

Something I sometimes forgot myself ;)

@AnthonyVH
Copy link
Contributor Author

Thanks for merging this in! I just noticed that I forgot to update the readme though, that still says all types must be different. Do you want to change this, or shall I create a new pull request?

@martinmoene
Copy link
Owner

You're welcome :)

Having a look at the old requirement of different type did cross my mind, but didn't follow through. I'll take care of it.

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

No branches or pull requests

2 participants