Subject: Re: [boost] [variant2] Need rationale for never-empty guarantee
From: Ivan Matek (libbooze_at_[hidden])
Date: 2019-03-01 17:53:00
> > On Fri, Mar 1, 2019 at 5:50 PM Robert Ramey via Boost <
> So as an exercise, you might experiment with your own use case regarding
I am not that interested in this since I know
<https://news.ycombinator.com/item?id=13050980> it will be slow, but if you
want to see a library that does that
There is also a boostcon talk.
I don't claim that variant with assignment is not
> useful/necessary. I'm really suggesting that perhaps might be
> interesting to consider a variant of variant (const variant?) which
> didn't assignment. The only problem with this is that implementation is
> so trivial that perhaps a library is not appropriate other than as a
> tool to motivate people to think about how they are using the variant in
> the first place.
I like const generally, but sometimes mutable variant is great. For example
if you model a state of your object with it,
so it has either ConnectedData, DisconnectedData or ConnectingData structs
as type. Then you do state transitions by
doing variant assignment.
Long story short is that generally people use mutability too much, but
sometimes they actually need it.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk