dariomt--- wrote:
The class boost::variant2::variant
is an almost conforming implementation of std::variant with the following differences: I see the useful comparison to std::variant in the doc, however I'm using boost::variant extensively in my code.
It would be very useful to have also a short comparison to boost::variant in the doc, as I would expect many more current users of the venerable boost::variant than of its much younger cousin std::variant.
The main difference is that Variant2 is a pin-compatible replacement for std::variant, whereas Boost.Variant isn't (at least for now). So it's easier to switch from std::variant to Variant2 and back (depending f.ex. on whether std::variant is available.)
The second most important difference would probably be the fact that Boost.Variant may do heap allocations.
This is useful info, thanks! I understand that the main objective is to offer a "better" std::variant, but as a user of Boost.Variant wondering "Should I consider migrating to Boost.Variant2?", I would expect a section in the doc addressing this question.