3 Mar
2019
3 Mar
'19
9:43 p.m.
Niall Douglas wrote:
This is why I would suggest variant2 provide elemental single_buffer_variant and double_buffer_variant, and let the end user choose which they want.
variant2 presently is single_buffer_variant except that instead of giving you an error when that's not possible, it silently switches to double_buffer_variant and soldiers on. (Which happens rarely.) I agree that one can make a good argument for (a variation of) double_buffer_variant, which prioritizes strong guarantee over sizeof. But that's only needed when your contained types don't have noexcept move. In this case, a not unreasonable course of action is to hold them by unique_ptr in the variant instead.