Subject: Re: [boost] [review][variant2] Variant2 Review Starts April 1
From: Peter Dimov (lists_at_[hidden])
Date: 2019-03-25 16:09:48


dariomt--- wrote:
> > The class boost::variant2::variant<T...> 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.