Subject: Re: [boost] [variant2] Andrzej's review -- design
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2019-04-04 22:24:22
On Thu, Apr 4, 2019 at 2:52 PM Mike via Boost <boost_at_[hidden]> wrote:
> > Every time you touch a variant object, you must
> consider the possibility of it being valueless.
> No I don't. It just works and I explained why. Could you please point
> out specifically where I made a mistake in my reasoning in the mail
> before where I discussed the behavior of all member functions?
What you described is how easy you think it is to handle the valueless
state, not that you don't have to.
I can't state this more clearly: if you have a valueless state then you
must define behavior for it, throughout the program. For example,
documenting a function that takes a variant you have to specify what
happens if the caller passes an empty variant (which he is now invited to
do). Hence my choice of words, "consider the possibility of it being
> And again: I'm not arguing that one is better than the other. I'm
> saying it doesn't matter, but I'd much perfer a design that is in line
> with std::variant instead of having yet another slightly incompatible
> version of variant that doesn't offer any significant benefit
I see this difference in design as critical.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk