8 Apr
2019
8 Apr
'19
7:29 a.m.
On 8/04/2019 18:29, Robert Ramey wrote:
LOL - Looks good to me! So now we have std::variant that is guaranteed to have a valid state with no double buffer BS and no extra overhead.
It's restricted to only trivial types, however, which sharply limits its usability. (Mostly just to primitives and PODs, though that's an oversimplification.) Or did you mean to check is_nothrow_constructible rather than is_trivially_constructible? (Also, for robustness you should check assignment as well as construction.)