Boost logo

Boost :

Subject: Re: [boost] [variant2] Need rationale for never-empty guarantee
From: Ivan Matek (libbooze_at_[hidden])
Date: 2019-03-01 17:13:44


On Fri, Mar 1, 2019 at 5:50 PM Robert Ramey via Boost <boost_at_[hidden]>
wrote:

> C++ starts from the idea that every instance should be mutable and hence
> gives you an assignment operator by default. The design discussions
> around variant (expected, outcome, ...) presume that this operation must
> be implemented. I question this. Not only for variant, but for many
> other C++ data types.
>
> Robert Ramey
>
 It is part history, part performance, for example your immutable integers
work fine and fast, but if you had immutable strings and pushback was O(n)
or string was no longer an array that would be problematic.

As for variant2:
I personally hate std::variant since valueless_by_exception is something
like std::bad_alloc(nobody tests for that like Niall said).
Also can the author compare variant2 with
https://github.com/cbeck88/strict-variant (that looks nice from my reading
of documentation).

regards,
Ivan


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