On 8/04/2019 05:03, Peter Dimov wrote:
Phil Endecott wrote:
- I would love to have some way to get a warning or error if the double storage mode had been triggered, or to disable that mode (with an error).
I was thinking of addressing this by adding either
static constexpr bool variant
::is_single_buffered(); or
static constexpr bool variant
::is_double_buffered(); (not sure which spelling is better), so that you can static_assert that your variants are never double-buffered.
Something like this would definitely be nice. Especially when something as simple as accidentally omitting "noexcept" can cause a significant behavioural and storage size change, it's great to be able to tell the compiler that this was unintended. (Of course, as I've said before I would have preferred that this choice was made by providing two different front-end "variant" types -- that way the assert is already inside the library and the user can't forget to make it.)