Is there some kind of deeper magic going on in the "constexpr if" version than it looks like?
Is there some kind of deeper magic going on in the "constexpr if" version than it looks like?
If you want full coverage then visitation guarantee that statically. Multi-visitation over m variants each with N possible types also does this statically with N^m instantiations. This balloons quickly, which is why I mentioned yomm2, which can add these handlers dynamically at runtime for polymorphic types.
(And thinking about this a bit more, there's presumably also the opposite case: if you add a branch for a type that's not a member of the variant / remove a type from a variant without updating all the visitors, it'd just happily compile with no indication that anything is wrong.)
And yes, C++ is an endless pit of horrors.