Subject: Re: [boost] [variant2] Need rationale for never-empty guarantee
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2019-03-02 22:56:04
On 3/2/19 3:31 PM, Niall Douglas via Boost wrote:
>>> You see, I would consider any union-based storage as in the same
>>> category. By definition union-based storage must contain a "pointer" to
>>> the correct way to interpret that union-based storage.
>> I don't understand this. Andrzej says pointers and
>> means it literally: T*. You say "pointers" and
>> I have no idea what you mean by it and what relation
>> it has to exception safety.
> If an object *selects* another object, then in my opinion it needs to
> propagate the strongest possible exception guarantees it can for
> assignment, swap and emplace.
> If an object *aggregates* other objects, then in my opinion it is
> permitted to have partial operations. So swap can get half way into
> swapping the individual members in the aggregate, and bail out.
> This might help:
> T*: Selects a T[1...N]
> unique_ptr<T[x]>: Selects a T[x]
> vector<T>: Selects a T[0...N]
> optional<T>: Selects a T, or a T
> variant<A, B, C>: Selects one of a A, B, or C, with all others 
> struct: Aggregate of heterogeneous types
> T[x]: Aggregate of x homogeneous T's
> array<T, x>: Aggregate of x homogeneous T's
> Can you see the difference yet? The first group selects an aggregate
> *elsewhere*. The second grouo IS an aggregate.
Nope. The second group makes sense to me. The
first is just a grab bag of everything that isn't
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk