|
Boost : |
Subject: Re: [boost] [hana]Either generalization & missing variant
From: Gonzalo BG (gonzalobg88_at_[hidden])
Date: 2015-06-09 03:57:23
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk