Closed AnthonyVH closed 3 years ago
@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.
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.
Just to be sure: include/variant.hpp
is generated from template/variant.hpp
using script/generate_header.py
.
Something I sometimes forgot myself ;)
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?
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.
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'sstd::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.