
9 Jun
2015
9 Jun
'15
7:57 a.m.
While a constexpr variant is a very useful utility its scope for meta-programming is limited. IIRC a constexpr variant can only hold types that are trivially_destructible (a recursive union with an user-defined destructor is not constexpr). To allow mutation the types it holds must be trivially_constructible, and trivially_copy_constructible/assignable. These requirements are pretty strict. Given such a variant type, variant<type<A>, type<B>, type<C>> should work tho. I don't know how useful this is but maybe this is what Larry Evans had in mind. Anyhow, implementing a variant seems completely out-of-scope for Hana. Bests, Gonzalo