Boost logo

Boost :

Subject: Re: [boost] [review][variant2] Variant2 Review Starts April 1
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2019-03-26 20:45:52


On Tue, Mar 26, 2019 at 2:29 PM Larry Evans via Boost
<boost_at_[hidden]> wrote:
> On 3/26/19 1:10 PM, Matt Calabrese via Boost wrote:
> > That cannot work for a variety of reasons. Even if it were possible to
> > implement it that way and we were okay with a dependence on the
> > standard library having std::variant, it also would mean that
> > interactions with the variant via the base class would be able to
> > break the child class's never-empty guarantee (meaning it would not be
> > a guarantee). So an inheritance relationship here would not make
> > sense.
> >
> Good point. Then how about:
>
> template<typename... T>
> struct boost::variant2<T...>
> : private std::variant<T...>
> {
> using std::variant<T...>::
> //{ all member functions **not** breaking never-valueless};
> //{ over-rides for those member functions that
> **do** break never-valueless}
> //}
> };

I don't think it's realistically implementable that way (need to
manipulate index, cases for double-storage, presumed desire to avoid a
<variant> dependency, etc.).

-- 
-Matt Calabrese

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk