|
Boost : |
From: Eric Friedman (ebf_at_[hidden])
Date: 2003-11-04 22:07:23
Persson Jonas wrote:
>>-----Original Message-----
>>From: Eric Friedman [mailto:ebf_at_[hidden]]
>>Sent: den 4 november 2003 00:46
>>To: Persson Jonas
>>Subject: Re: Variant size bug?
>
[snip]
>>Well, yes: variant<> *is* variant<boost::empty>.
>>As it stands currently,
>>there is no such thing as a variant with no content; the closest
>>approximation is a variant with boost::empty content.
>
> Yes I understand that, but *why*? What are the conceptual reasons
> for not allowing truly empty variants?
There are no conceptual obstacles per se; rather, the design was crafted
so that visitation would always be a successful operation (i.e.,
visitation itself would never fail). With truly empty content, I believe
you can see this is not possible.
Anyhow, as I just posted on the list, I've changed variant so that, at
least in the 1.31 release, variant<> is not supported at all. Similarly,
variant on an empty type sequence will lead to a compile-time error.
While this change perhaps does not help you with your metaprogramming
'termination' condition, it does open up variant for future changes
without negative effects on backwards compatibility.
Eric
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk