4 Mar
2019
4 Mar
'19
3:33 p.m.
Niall Douglas wrote:
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.
Except I don't want to pay for the dynamic memory allocation.
Types that don't have noexcept move typically already allocate. Yes, it's an extra allocation, but going from 1 to 2 is not the same as going from 0 to 1.