2 Apr
2019
2 Apr
'19
4:52 p.m.
Andrzej Krzemienski wrote:
It should be noted that variant2 DOES NOT PROVIDE A STRONG EXCEPTION SAFETY GUARANTEE.
Yes, variant2::variant is a never-valueless, basic guarantee variant. There probably does exist a legitimate need for a strong guarantee variant, which would have to make different design tradeoffs. It's certainly possible to add one in the future, if there's demand. (For instance, a "strong" variant wouldn't delegate to T::op= in its assignment, from which it falls out that it would be able to store non-assignable types and still be assignable itself. It would double-buffer much more often though.)