
You can't in the general case because you have to call the constructor of the appropriate internal type. You can't placement new, so you have to do it via a member initializer, so which internal type's constructor do you call?
I see. You have to decide the member initialization based on a runtime value. Thats just not possible. However, the more I think about it, I don't think a constexpr union type makes much sense. The type is known at compile-time. Instead a constexpr sum type would just store the type and the possible types: template<class T, class... Choices> class constexpr_sum_type : T { ... }; Then the `Choices...` types can be used in the visitor to enforce compile time checking of all the branches. Perhaps, some generalized unpacking mechanism could help normalize the usage of constexpr and non-constexpr sum types. Paul -- View this message in context: http://boost.2283326.n4.nabble.com/Another-variant-type-was-peer-review-queu... Sent from the Boost - Dev mailing list archive at Nabble.com.