Boost logo

Boost :

Subject: Re: [boost] [variant] Warning: variadic templates in boost::variant
From: Larry Evans (cppljevans_at_[hidden])
Date: 2013-12-09 12:31:48


On 12/09/13 08:52, Steven Watanabe wrote:
[snip]> variant<> doesn't
> really make sense, because it's impossible to satisfy
> this invariant.

I'm not as sure variant<> doesn't make some sense.
tuple<> makes sense, at least according to:

   http://en.wikipedia.org/wiki/Tuple

and variant<> is a "dual" to tuple:

   http://en.wikipedia.org/wiki/Dual_%28category_theory%29

Also the following:

   http://en.wikipedia.org/wiki/Coproduct

says:

   The coproduct indexed by the empty set
   (that is, an empty coproduct)
   is the same as an initial object in C.

where C is some category and "coproduct", IIUC, is what
variant is (the Coproduct page mentions it at
a "disjoint union of sets").

Hence, at least the Coproduct page sees some merit
in defining an "empty coproduct" or variant<>.

-regards,
Larry


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