Subject: Re: [boost] [variant2] Andrzej's review
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2019-04-13 22:13:49
>> What I specifically meant was "worse-than-useless choice of
>> implementation by variant2 of the basic guarantee which is only
>> technically valid, but is certainly surprising".
> I'll repeat myself, I fail to see any logic in this statement that doesn't
> apply to std::vector::op=.
> Yes, with variant2 the contained type may change, whereas the type of the
> objects in the vector won't change, but this is irrelevant. It's like
> saying well, at least variant won't change its size, whereas a vector
> could, and that is "technically valid but is certainly surprising".
> Yes indeed, when an error occurs, you might find objects in a state that
> you didn't set explicitly. Being surprised that the state may change is
> equivalent to not understanding how error handling works under the basic
The problem is the hard coding of random change of state on exception
throw during assignment. Yes, a vector may be in some weird state after
an exception throw middle of operator=. But that's on you for your
choice of T in vector<T>. It's not hard coded into vector's design as a
default, so it's imposed on all users of vector.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk