Boost logo

Boost :

Subject: Re: [boost] [variant] Maintainer
From: Peter Dimov (lists_at_[hidden])
Date: 2015-07-14 14:33:13


Larry Evans wrote:

> Thanks Peter.
>
> To be explicit:
>
> tuple<> t0;
>
> would be allowed, but:
>
> variant<> v0;
>
> wouldn't compile because there are "zero valid values" in a variant<>?

Yes; you can use the type variant<> but you can't declare a variable of it.
N4542 says

variant<>
A variant without alternatives cannot be constructed; it is otherwise an
allowed
type. It is easier to allow it than to forbid it.

which is consistent with variant being a sum type without an extra empty
state (same as boost::variant).

For a variant that has an extra empty state, one would expect variant<> to
be instantiable and always empty.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk