Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-08-30 14:30:42

On Thursday 30 August 2001 02:35, you wrote:

> > > exactly the same as a value that might be uninitialized.
> >
> > I think it is just a matter of definition. Having the current type of a
> > variant<T, void> be void can be considered equivalent to having an
> > uninitialized T value.
> Not *just* a matter of definition.
> The fact that a variant user can use a type which he/her uses as an alias
> to void is *external* to the variant interface.
> That is, variant itslelf -at least currently- doesn't handle an 'empty
> type' any different. It is not aware of the semantic of 'empty'; so the
> 'emptyness' of variant<empty> is not part of the variant interface -or is
> it part of its interface just as the exponent is part of the interface of
> variant<double>'.
> Unless, of course, you support 'empty' inside variant explicitely.
> optional<T>, on the other hand, defines the concept of 'uninitialized'
> state by itself, it is a property of its interface.

I think the question is "whose definition?" The user can define the "empty"
type to mean an uninitialized value, in which case variant<empty, T> supports
the notion of having an uninitialized value. In any case I understand your
point: that variant doesn't include the notion of "uninitialized" internally.


Boost list run by bdawes at, gregod at, cpdaniel at, john at