Boost Users :
Subject: Re: [Boost-users] boost variant is not a literal type
From: AgustÃn K-ballo BergÃ© (kaballo86_at_[hidden])
Date: 2016-01-06 16:03:02
On 1/6/2016 5:52 PM, Robert Ramey wrote:
> I want to use Boost.Variant constexpr function. In order to do this it
> has to be a literal type - which apparently it isn't. The rule for
> being a literal type are summarized here:
> a boost::variant isn't default constructable so it fails to qualify.
A default constructor is not a requirement of literal type.
> Has anyone else had this problem before and managed to solve it in a
> convenient way?
Constexpr support is a complicated thing for `variant`, and it would
require a complete reimplementation of `boost::variant`. The trickiest
part is having a trivial destructor. For the gory details have a look at
Also note that literal unions are over restricted, and that restricts
the kind of member types a literal variant might have. That's CWG2096
-- Agustín K-ballo Bergé.- http://talesofcpp.fusionfenix.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net