I'm restricted to C++11 for reasons I won't go into (think CUDA). Now, I would like to be able to use an std::variant. Should I...
- "back-port" my C++ library's variant to C++11?
- Write my own (e.g. using aligned_union and reinterpret_cast, or a proper union, together with an option indicator of what it actually holds)?
- Use
boost::variant. - Use a complete(ish) stand-alone implementation - but then, which one? There seem to be quite a few on github.
The last option has worked out very well for me with an std::optional drop-in-replacement I got from here; but maybe there are gotchas I'm unaware of.
How feasible/reasonable are these different options?
Aucun commentaire:
Enregistrer un commentaire