> On 9 Apr 2018, at 18:17, Frank Heckenbach <f.heckenb...@fh-soft.de> wrote: > > Hans Åberg wrote: > >>> So for C++ we could either go back and disable the static type >>> checking completely, or do full dynamic checking (which std::variant >>> does by itself). I choose the latter. As you said, the performance >>> impact should be small, and the safety benefit substantial. (If >>> someone doesn't want it, they might be able to use an alternative >>> variant implementation without checks, or not use variant at all >>> ...) >> >> That might be the difference: C++, unlike C, needs the types to >> select the right constructors. To get those and not only PODs was >> one motivation for introducing the variants. > > Indeed, if one only wants to use PODs in C++, one can use the C > template (which I did until recently), so there's not much point > (IMHO) to a C++ template that supports only PODs.
There were much discussion about that, leading up to the variants.