|
Boost : |
Subject: Re: [boost] Variant2 review
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2019-04-08 18:49:07
pon., 8 kwi 2019 o 19:55 Peter Dimov via Boost <boost_at_[hidden]>
napisaÅ(a):
> Andrzej Krzemienski wrote:
>
> > Such thing could be achieved if the behavior of variant's assignment and
> > emplacement was controlled by a type trait. The default implementation
> for
> > unfriendly types would be compile-time error; but users would be able to
> > specialize it for their instantiations of variant in order to assign
> > different semantics: double buffering, or setting the
> > valueless_by_exception state.
>
> This can't work in general. If you have
>
> template<class... T> class lib1::X
> {
> private:
>
> variant<T...> state_;
> };
>
> and
>
> template<class... T> class lib2::Y
> {
> private:
>
> variant<T...> state_;
> };
>
> it's not possible for lib1 and lib2 to choose their preferred variant
> behaviors independently of one another.
>
Indeed. Good point.
Regards,
&rzej;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk